Tuesday, December 6, 2011
Thursday, April 28, 2011
How to Keep Password on Post Back Event
Just Add The Following Code to code file: means aspx.cs file
If(!IspostBack)
{
TextPassword.Attribute.Add("value","TextPassword.Text");
}
here TextPassword is TextBox ID which you use for Textbox Password
If(!IspostBack)
{
TextPassword.Attribute.Add("value","TextPassword.Text");
}
here TextPassword is TextBox ID which you use for Textbox Password
How to use Required Field validator on Dropdownlist
for Example:- the following code will help you
<asp:DropDownList ID="DropDownList1" runat="server" CssClass="Style1">
<asp:ListItem Value="0">select item</asp:ListItem>
<asp:ListItem Value="4">A</asp:ListItem>
<asp:ListItem Value="1">B</asp:ListItem>
<asp:ListItem Value="2">C</asp:ListItem>
<asp:ListItem Value="3">D</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator_Drop" runat="server" <asp:ListItem Value="0">select item</asp:ListItem>
<asp:ListItem Value="4">A</asp:ListItem>
<asp:ListItem Value="1">B</asp:ListItem>
<asp:ListItem Value="2">C</asp:ListItem>
<asp:ListItem Value="3">D</asp:ListItem>
</asp:DropDownList>
ErrorMessage="Select Any Items" ControlToValidate="DropDownList1"
CssClass="Style1" InitialValue="0"></asp:RequiredFieldValidator>
The main think is that you have to set Initial value Property with same as value of top of list Item of Dropdownlist
Friday, March 4, 2011
Subscribe to:
Posts (Atom)