AspdotnetCodes.com
Voted 'Best ASP.NET Host' for 2008 – DiscountASP.NET
 
Articles Subscribe for our Articles Updates
Books
Resources
Downloads
Free Tech Magazines
Archives
Softwares
Newsletter
Suggest Us
Link to Us
  DropdownList in WebUserControl
Posted by Sanjeev Gupta on  2/20/2008 6:33:41 AM Category: Asp.Net 2.0
Add to my favorites
Email to friend
  
I am using asp.net2.0 and vs2005.
In Web user Control List of Product Bind in Drop Down List. This web User control drag in Contain Page.But i want when user click submit Button .then show the Message Please Select Product.Because Select Product Show in Drop Down Firstly in Drop Down List.

please Solve the Problam AnyBody using validation or javaScript Function

Post Answer Post New Question

 Viewer's Answers
Use JavaScript to validate
Posted By Moderator1 on 2/20/2008 7:35:29 PM
Description:
In your web user control validate the dropdown list with javascript. Set the value of the 'Select Product' to 0. Then

function CheckProductCombo()
{
if (document.getElementById('<%=DropDownList1.ClientID%>').value=="0")
{
alert('Select Product');
return false;
}

}
 
Sponsored by