after postback font-sizes go crazy!!
-
Hi! on a site I'm writing i use a TextBox and a Button for some search functionality..in the Button's onClick event i assigned a method :
public void Search(object sender, EventArgs e) { Response.Write(string.Concat("window.open(\"SearchResluts.aspx?KeyWord=", tbSearch.Text, "\",\"iContent\");")); }
all it does is open SearchResluts page in iContent iframe.. above the button and textbox there is a treeview and when i click the button it does what it should and changes font-size in the treeview.. i saw it somewhere before that after postback some control's font-size is changed (for larger one).. does anyone have any idea why this happens and maybe knows a workaround? thanks for any help..life is study!!!
-
Hi! on a site I'm writing i use a TextBox and a Button for some search functionality..in the Button's onClick event i assigned a method :
public void Search(object sender, EventArgs e) { Response.Write(string.Concat("window.open(\"SearchResluts.aspx?KeyWord=", tbSearch.Text, "\",\"iContent\");")); }
all it does is open SearchResluts page in iContent iframe.. above the button and textbox there is a treeview and when i click the button it does what it should and changes font-size in the treeview.. i saw it somewhere before that after postback some control's font-size is changed (for larger one).. does anyone have any idea why this happens and maybe knows a workaround? thanks for any help..life is study!!!
Instead Of Response.Write , try this Page.RegisterStartupScript("p", string.Concat("window.open(\"SearchResluts.aspx?KeyWord=", tbSearch.Text, "\",\"iContent\");")); " If u got solution plz vote here " Best Regard Pathan
---------------------------------------------------
-
Hi! on a site I'm writing i use a TextBox and a Button for some search functionality..in the Button's onClick event i assigned a method :
public void Search(object sender, EventArgs e) { Response.Write(string.Concat("window.open(\"SearchResluts.aspx?KeyWord=", tbSearch.Text, "\",\"iContent\");")); }
all it does is open SearchResluts page in iContent iframe.. above the button and textbox there is a treeview and when i click the button it does what it should and changes font-size in the treeview.. i saw it somewhere before that after postback some control's font-size is changed (for larger one).. does anyone have any idea why this happens and maybe knows a workaround? thanks for any help..life is study!!!
You should use
RegisterClientScriptBlock
instead. When you do aResponse.Write
the code gets written on top of the page and that affects the font sizes. When you useRegisterClientScriptBlock
, the code goes into the HTML tag. This code is for Asp.Net 2.0, if your using Asp.Net 1.1 then you will have to usePage.RegisterClientScriptBlock
StringBuilder strScript = new StringBuilder();
strScript.Append("<script language="javascript">window.open('FileToOpen.aspx');</script>");
ClientScript.RegisterClientScriptBlock(Page.GetType(), "subscribescript", strScript.ToString());
Tarakeshwar Reddy MCP, CCIE Q(R&S) There are two kinds of people, those who do the work and those who take the credit. Try to be in the first group; there is less competition there. - Indira Gandhi
-
Hi! on a site I'm writing i use a TextBox and a Button for some search functionality..in the Button's onClick event i assigned a method :
public void Search(object sender, EventArgs e) { Response.Write(string.Concat("window.open(\"SearchResluts.aspx?KeyWord=", tbSearch.Text, "\",\"iContent\");")); }
all it does is open SearchResluts page in iContent iframe.. above the button and textbox there is a treeview and when i click the button it does what it should and changes font-size in the treeview.. i saw it somewhere before that after postback some control's font-size is changed (for larger one).. does anyone have any idea why this happens and maybe knows a workaround? thanks for any help..life is study!!!
When you use javascript using response.write, the javascript is written before tag That makes the browser ignore the doctype, and the page is displayed in quirks mode. The solution suggested above is the best way to do it. There is also a workaround: write response.write() code before response.write tag. don't know how good this solution is, but it works perfectly well.