I am trying to get the actual HTML text for the control from the client browser because some of the info in this control don't show on the sever side special the "Style". So How can get the whole HTML text for a control?
Asked
Active
Viewed 259 times
0
-
You can move to asp.net mvc and forget about controls altogether! It's heaven! :-) – Dan Nov 08 '13 at 15:50
-
what about `Control.Attributes["style"]`? what is the need of getting the style attribute in server side? – Murali Murugesan Nov 08 '13 at 15:55
-
@Murali I tried but it is empty – kartal Nov 08 '13 at 15:59
-
@kartal, does the control/page has a viewstate enabled? – Murali Murugesan Nov 08 '13 at 16:03
-
Take a look at this: http://stackoverflow.com/questions/58925/asp-net-how-to-render-a-control-to-html Regards, Uros – Uroš Goljat Nov 08 '13 at 16:07
-
@kartal, try using control.InnerHTML property – Murali Murugesan Nov 08 '13 at 16:16
1 Answers
0
<asp:TextBox ID="tb1" runat="server" OnChange="tbOnChange();" />
<script type="text/javascript">
function tbOnChange() {
var tb1 = document.getElementById('tb1');
alert(tb1.value);
}
</script>
EDIT: For get style in C#
ASP page:
<input type="text" id="tb1" runat="server" style="color:Red;" />
C# page:
protected void Page_Load(object sender, EventArgs e)
{
var style = tb1.Style;
}
Regards
k.

kintaro
- 2,393
- 2
- 16
- 16