How to get HTML controls in code behind
-
Hi I am using two HTML radio buttons <td align="left" style="height:40px;vertical-align:middle " > <input type="radio" id="rdoLeaveExcHoliday" value="1" name="rdoLeaveOption" onclick=" SelectLeaveType(this,'1');" />Leaves-excluding holidays and weekends <input type="radio" id="rdoLeaveIncHoliday" value="2" name="rdoLeaveOption" onclick=" SelectLeaveType(this,'2');" />Leaves-including holidays and weekends </td> I want to make second radio button invisible if my dataset in code behing returns zero. I canot make them runat="server" How to get it? Any help will be appreciated.. Thanks in advance
Inderjeet Kaur Sr. Software Engg
-
Hi I am using two HTML radio buttons <td align="left" style="height:40px;vertical-align:middle " > <input type="radio" id="rdoLeaveExcHoliday" value="1" name="rdoLeaveOption" onclick=" SelectLeaveType(this,'1');" />Leaves-excluding holidays and weekends <input type="radio" id="rdoLeaveIncHoliday" value="2" name="rdoLeaveOption" onclick=" SelectLeaveType(this,'2');" />Leaves-including holidays and weekends </td> I want to make second radio button invisible if my dataset in code behing returns zero. I canot make them runat="server" How to get it? Any help will be appreciated.. Thanks in advance
Inderjeet Kaur Sr. Software Engg
Hi There are two things you have to do. (1) Edit the HTML code to include the attribute runat="server" in the opening tag of the HTML control. For example for a table it might be:
(2) Then you need to include the namespace "System.Web.UI.HtmlControls" in the code behind (e.g. in VB the directive Imports System.Web.UI.HtmlControls). If you are using Visual Studio then you will find that it will become available in auto-complete under the identifier (in the example above) Table1. With that you will be able to program it's behaviour in a very similar manner to web Server controls. Hope that helps! :thumbsup: Deepak Surana