Why this ont rendering the Control properly
-
I tried to create one LinkButton. Used this code.
Dim hlink As LinkButton
Dim sw As System.IO.StringWriter
Dim htw As HtmlTextWriter
hlink = New LinkButton
hlink.ID = "ZoneLink"
hlink.Text = "TestButton"
sw = New System.IO.StringWriter
htw = New HtmlTextWriter(sw)
hlink.PostBackUrl = "Default2.aspx"
hlink.RenderControl(htw)
Response.Write(sw.ToString)But only displays the text. No hyperlink is displayed ?
-
I tried to create one LinkButton. Used this code.
Dim hlink As LinkButton
Dim sw As System.IO.StringWriter
Dim htw As HtmlTextWriter
hlink = New LinkButton
hlink.ID = "ZoneLink"
hlink.Text = "TestButton"
sw = New System.IO.StringWriter
htw = New HtmlTextWriter(sw)
hlink.PostBackUrl = "Default2.aspx"
hlink.RenderControl(htw)
Response.Write(sw.ToString)But only displays the text. No hyperlink is displayed ?
-
Use this code (is in c#): Literal lit = new Literal(); lit.Text = @"<a href=""Default2.aspx"">TestButton</a>"; lit.RenderControl(htw); Response.Write(sw.ToString());
This method is not causing the postback event.
-
This method is not causing the postback event.
-
Ok then try this: LinkButton hlink = new LinkButton(); hlink.ID = "ZoneLink"; hlink.Text = "TestButton"; hlink.PostBackUrl = "Default2.aspx"; form1.Controls.Add(hlink);
Thanks for the reply darkcalin. The thing is that they have created one user control which gets html tags as input and prints a table. But I I add this to form , my problem is not solved. What I am doing is that creating a control and and rendering its contents to html page. Hope I am clear now
-
Thanks for the reply darkcalin. The thing is that they have created one user control which gets html tags as input and prints a table. But I I add this to form , my problem is not solved. What I am doing is that creating a control and and rendering its contents to html page. Hope I am clear now
Try this: :doh: HyperLink hlink = new HyperLink(); System.IO.StringWriter sw = new System.IO.StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); hlink.ID = "ZoneLink"; hlink.Text = "TestButton"; hlink.NavigateUrl = "Default2.aspx"; hlink.RenderControl(htw); Response.Write(sw.ToString());
-
Try this: :doh: HyperLink hlink = new HyperLink(); System.IO.StringWriter sw = new System.IO.StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); hlink.ID = "ZoneLink"; hlink.Text = "TestButton"; hlink.NavigateUrl = "Default2.aspx"; hlink.RenderControl(htw); Response.Write(sw.ToString());
This one I have Already tried. The things is that the HyperLink is Not Causing the CrossPage postback. I need cross Page PostBack
-
This one I have Already tried. The things is that the HyperLink is Not Causing the CrossPage postback. I need cross Page PostBack
-
For moment i don't have any idea. Could you please write more code here to see how can we fix that :wtf:
Working on it