TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
rachayita jaiswal
NA
217
106.3k
Drop down validation in asp.net
Sep 2 2013 6:05 AM
Hi,
I have created validation for drop down -
<asp:DropDownList ID="ddl_assetVendor" runat="server" Width="200px">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFV_assetvendor" runat="server" ControlToValidate="ddl_assetVendor" InitialValue="--Select Vendor--" ErrorMessage="Select Vendor Name!" Display="Dynamic" SetFocusOnError="true" >
</asp:RequiredFieldValidator>
Drop down values are coming from data base.
so function for load data in drop down is -
public void GetVendorName()
{
try
{
string ddlquery = "Select id,VendorName from m_vendor";
dt = obj_db.GetCommonDataByQuesry(ddlquery);
ddl_assetVendor.DataSource = dt;
ddl_assetVendor.DataBind();
ddl_assetVendor.DataTextField = "VendorName";
ddl_assetVendor.DataValueField = "id";
ddl_assetVendor.DataBind();
ddl_assetVendor.Items.Insert(0, new ListItem("--Select Vendor--", "0"));
}
catch (Exception ex)
{
GetErrorFile("GetAssetLocaion", ex.Message);
}
}
No my Initial value will be = --Select Vendor-- right.
But my drop down validation is not working .
Please tell is there any issue in my code?
Reply
Answers (
3
)
Creating a Simple Accordion using ajax toolkit
error