validation - ASP.NET RequiredFieldValidator : How can i bind value to " InitialValue " property? -
i have next code
<div> <asp:dropdownlist id="testdropdownlist" runat="server" validationgroup="testvalidationgroup"> <asp:listitem value="choose">[ select item ... ]</asp:listitem> <asp:listitem value="true">yes</asp:listitem> <asp:listitem value="false">no</asp:listitem> </asp:dropdownlist> <asp:requiredfieldvalidator id="testrequiredfieldvalidator" runat="server" validationgroup="testvalidationgroup" errormessage="*" initialvalue="choose" controltovalidate="testdropdownlist"></asp:requiredfieldvalidator> <br /> <asp:button id="testbutton" runat="server" onclick="testbutton_click" text="button" validationgroup="testvalidationgroup" /> <br /> </div>
in validate dropdownlist requiredfieldvalidator
if changed value of initialvalue
property read static property in stactic classs .. give me emtpy string in runtime unless property have value "choose" ...
<asp:dropdownlist id="testdropdownlist" runat="server" validationgroup="testvalidationgroup"> <asp:listitem value="choose">[ select item ... ]</asp:listitem> <asp:listitem value="true">yes</asp:listitem> <asp:listitem value="false">no</asp:listitem> </asp:dropdownlist> <asp:requiredfieldvalidator id="testrequiredfieldvalidator" runat="server" validationgroup="testvalidationgroup" errormessage="*" initialvalue='<%# util.choosevalue %>' controltovalidate="testdropdownlist"> </asp:requiredfieldvalidator> <br /> <asp:button id="testbutton" runat="server" onclick="testbutton_click" text="button" validationgroup="testvalidationgroup" />
could 1 help me know what's issue in code ??
please phone call
testrequiredfieldvalidator.databind()
in page load event , allow me know if still issue.
asp.net validation requiredfieldvalidator html-select
No comments:
Post a Comment