Click here to Skip to main content
15,914,416 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Code for Downloading from website problem Pin
Not Active20-Jul-11 2:07
mentorNot Active20-Jul-11 2:07 
AnswerRe: Code for Downloading from website problem Pin
Prasanta_Prince20-Jul-11 19:49
Prasanta_Prince20-Jul-11 19:49 
AnswerRe: Code for Downloading from website problem Pin
kbalias21-Jul-11 20:35
kbalias21-Jul-11 20:35 
Questionpublish asp.net-silverlight-WCF in local iis Pin
yesu prakash19-Jul-11 21:05
yesu prakash19-Jul-11 21:05 
AnswerRe: publish asp.net-silverlight-WCF in local iis Pin
Viral Upadhyay20-Jul-11 1:58
Viral Upadhyay20-Jul-11 1:58 
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 

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.