Hi,
I am trying to write a code that creates a CheckBox inside htmlTable when the user selectes an option from a DropDownList..
So, How can i do that?? Please help me..!! :(
ASP.NET/VB.NET
Printable View
Hi,
I am trying to write a code that creates a CheckBox inside htmlTable when the user selectes an option from a DropDownList..
So, How can i do that?? Please help me..!! :(
ASP.NET/VB.NET
You need to do the following
1) Set the AutoPostBack property of the dropdownlist to TRUE.
2) Get a refference to the HTML table in your codebehind.
This can be done by doing 2 things
a) add the runat="server" attribute to the decalration of the HTML Table in the aspx page3) Place the code for adding a checkbox in the SelectedIndexChanged event.
b) Decalre a HTMLTable object for the class with the same id as the HTML Table
VB Code:
Protected Table1 As System.Web.UI.HtmlControls.HtmlTable
Sample Code:
VB Code:
Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged Dim tr As New HtmlTableRow Dim td As New HtmlTableCell Dim chk As New CheckBox td.Controls.Add(chk) tr.Cells.Add(td) Table1.Rows.Add(tr) End Sub
Thanks alot :)
i will try it