asp.net - Is there any other way to get the value of the html textbox in VB.net? -
other request.form("example") use name of textbox. want know if there other way value rather using request.form. hope guys understand mean , hope not dumb question. i'm having problem using name value of textbox consist.
so thought of using id value tell me if work.and know how works.
protected sub page_load(byval sender object, byval e system.eventargs) handles me.load if not ispostback each row datarow in carddt.rows literal1.text += "<tr>" literal1.text += "<td><input type='text' id='test" & & "' name='test" & & "' value='" & row("date") & "' maxlength='20'></td>" literal1.text += "<td><input id='checkbox1' type='checkbox' name='chk" & & "' /></td>" literal1.text += "</tr>" += 1 next literal1.text += " </table>" end sub
this button, check value stored in request.form when click on button receive error when used name:
protected sub button2_click(byval sender object, byval e eventargs) handles button2.click dim = 0 each row datarow in employeedt.rows dim t = request.form("test" & i) if request.form("check" & i) <> "" msgbox("check" & & " " & t) end if += 1 next end sub
there 2 ways. can choose 1 suits needs:
change html input control
asp:textbox
control. still render in browser html input anyways. shouldn't make difference, able access in code-behind. can valuecontrolid.text
.just add
runat="server"
attribute on html input (textbox) control, , can access in code-behind other server side control. can valuecontrolid.value
.
Comments
Post a Comment