Click here to Skip to main content
15,917,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have table -> groups

table coulmns -> groupno,groupname,status

i need to bind groupnames to dropdown with groupnos also

when user selected groupname i need to pick select groupno for user selection

dropdown first index should be like - "----select------"
then groupname for restricing the user to select one option


can u help me in code
Posted

Hi,

Try this link if could help.
Need to add All to the dropdownlist in the below.

To insert the ----select---- at the top of you dropdown list,
please see example above:

dphaircolor.Items.Insert(0,new ListItem("All", "All")); // Insert All at top selection

In manipulation of your group, I think you could be handle it with
your SQL where clause

Regards,

Algem
 
Share this answer
 
Hi Check this code.. oXMLNodeList = oXMLDoc.GetElementsByTagName("ProductDesc");
if ((oXMLDoc.ChildNodes.Count >= 1) && (oXMLNodeList.Count > 0))
{
DropDownList2.Items.Clear();
DropDownList2.Items.Add(new ListItem("-- Select Product Name --", "0"));
for (int intLoop = 0; intLoop <= oXMLNodeList.Count - 1; intLoop++)
{
strPlantId = oXMLDoc.GetElementsByTagName("ProductDesc").Item(intLoop).InnerText;
// strCategoryName = RXMLReservedChrConvert(oXMLDoc.GetElementsByTagName("Product_Name").Item(intLoop).InnerText);
DropDownList2.Items.Add(new ListItem(strPlantId));
}
}
else
{
DropDownList2.Items.Clear();
DropDownList2.Items.Add(new ListItem("No Product Information Exit, Please add."));

}this will be helpfull for you..
 
Share this answer
 
C#
Drp.DataTextField = "groupname ";
   Drp.DataValueField = "groupno";
   Drp.DataBind();
  Drp.Items.Insert(0,new ListItem("All", "----select------"));
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900