Click here to Skip to main content
15,885,985 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionHow to get Gridview to respond to Select command on Blackberry Browser (Curve 8530) Pin
David Mujica19-Jul-11 4:58
David Mujica19-Jul-11 4:58 
SuggestionRe: How to get Gridview to respond to Select command on Blackberry Browser (Curve 8530) Pin
Anurag Gandhi19-Jul-11 20:40
professionalAnurag Gandhi19-Jul-11 20:40 
QuestionJquery code is not working in IE [modified] Pin
meghamaharshi19-Jul-11 1:16
meghamaharshi19-Jul-11 1:16 
AnswerRe: Jquery code is not working in IE Pin
Shameel19-Jul-11 4:49
professionalShameel19-Jul-11 4:49 
AnswerRe: Jquery code is not working in IE Pin
Not Active19-Jul-11 7:49
mentorNot Active19-Jul-11 7:49 
QuestionASP.NET Login Control always logged in Pin
Dominick Marciano18-Jul-11 18:18
professionalDominick Marciano18-Jul-11 18:18 
AnswerRe: ASP.NET Login Control always logged in Pin
Dominick Marciano18-Jul-11 18:44
professionalDominick Marciano18-Jul-11 18:44 
QuestionHelp with page.header.controls.add() throw NullReferenceException. [modified] Pin
josehidalgor18-Jul-11 12:44
josehidalgor18-Jul-11 12:44 
Hi, Im working with this method. The problem is that Im creating a new page and then try to assing the Header.Title but it will throw and exception of NullReferenceException.

public static string RenderControl(string controlName)
{
Page page = new Page();
page.Header.Title = "New Page";
page.Controls.Add(header);
UserControl userControl = (UserControl)page.LoadControl(controlName);
userControl.EnableViewState = false;
HtmlForm form = new HtmlForm();
form.Controls.Add(userControl);
page.Controls.Add(form);

StringWriter textWriter = new StringWriter();
HttpContext.Current.Server.Execute(page, textWriter, false);
return textWriter.ToString();
}

Same thing if I try to add

HtmlLink myCSS = new HtmlLink();
myCSS.Href = "~/somecss1.css";
myCSS.Attributes.Add("rel", "stylesheet");
myCSS.Attributes.Add("type", "text/css");
Page.Header.Controls.Add(myCSS);

I try to set a new header but It says

page.Header
(Gets the document header for the page if the head element is defined with a runat=server in the page declaration.

but when you see the new Page() constructor it says <No Parameters> Cant set the header with attr runat=server when initialize the page.



Regards

modified on Monday, July 18, 2011 6:52 PM

AnswerRe: Help with page.header.controls.add() throw NullReferenceException. Pin
Parwej Ahamad19-Jul-11 8:33
professionalParwej Ahamad19-Jul-11 8:33 
QuestionGridview To Export Excel sheet Pin
vishnukamath18-Jul-11 0:07
vishnukamath18-Jul-11 0:07 
SuggestionRe: Gridview To Export Excel sheet Pin
RaviRanjanKr18-Jul-11 1:23
professionalRaviRanjanKr18-Jul-11 1:23 
AnswerRe: Gridview To Export Excel sheet Pin
R. Giskard Reventlov18-Jul-11 4:19
R. Giskard Reventlov18-Jul-11 4:19 
Questionresponse.redirect afetr few seconds Pin
benams17-Jul-11 11:35
benams17-Jul-11 11:35 
AnswerRe: response.redirect afetr few seconds Pin
Parwej Ahamad17-Jul-11 19:48
professionalParwej Ahamad17-Jul-11 19:48 
AnswerRe: response.redirect afetr few seconds Pin
Morgs Morgan7-Aug-11 23:53
Morgs Morgan7-Aug-11 23:53 
QuestionSSRS run time design Pin
Ramkumar_S17-Jul-11 3:14
Ramkumar_S17-Jul-11 3:14 
QuestionRe: SSRS run time design Pin
Shameel17-Jul-11 23:16
professionalShameel17-Jul-11 23:16 
QuestionASP.NET Windows Based Auth Question Pin
Badg3r197715-Jul-11 5:46
Badg3r197715-Jul-11 5:46 
AnswerRe: ASP.NET Windows Based Auth Question Pin
David Mujica15-Jul-11 5:58
David Mujica15-Jul-11 5:58 
AnswerRe: ASP.NET Windows Based Auth Question Pin
Shameel17-Jul-11 23:21
professionalShameel17-Jul-11 23:21 
QuestionHow to integrate facebook on a site? Pin
alexa_adrian200114-Jul-11 23:02
alexa_adrian200114-Jul-11 23:02 
AnswerRe: How to integrate facebook on a site? Pin
Not Active15-Jul-11 2:29
mentorNot Active15-Jul-11 2:29 
GeneralRe: How to integrate facebook on a site? Pin
alexa_adrian200115-Jul-11 2:32
alexa_adrian200115-Jul-11 2:32 
GeneralRe: How to integrate facebook on a site? Pin
DaveAuld17-Jul-11 20:10
professionalDaveAuld17-Jul-11 20:10 
GeneralRe: How to integrate facebook on a site? Pin
alexa_adrian200117-Jul-11 20:43
alexa_adrian200117-Jul-11 20:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.