c# - Checkbox not working in asp.net and HTML mixed page -
i'm grappling issue site asp.net/c# controls on .aspx pages html , i'm not sure how go on if change asp.net controls. change minor. tasked add check box, in <input type="checkbox" name="disablefeaturemanager" runat="server" id="disablefeaturemanager" />disable feature manager
, in .cs page want check if box checked , make decisions based on that, control's checked property false
. submit button html control: <input type="submit" value="start" name="submitbutton" />
in page_load
ckecking if check returns false.
if (disablefeaturemanager != null && disablefeaturemanager.checked) nexturl.append(featuremanagerchoices.createquerystringfromformdata(request.form));
you keep checkbox html server control doing following:
<input type="checkbox" name="disablefeaturemanager" runat="server" id="disablefeaturemanager" />
then change button web control follows:
<asp:button id="submitstart" runat="server" onclick="btn1_click" text="start" clientidmode="static" />
the difference above rendered html name output have id submitstart
due clientidmode
being static, if need friendly consistent id javascript manipulation.
to wire in event add code read value checkbox:
protected void btn1_click(object sender, eventargs e) { var ischecked = disablefeaturemanager.checked; }
Comments
Post a Comment