Hi,
Now i need my project for adding cusomt values in dropdown. meantime. I had dropdown named like biodata, its consists of age, gender,sex, religion. Now i need add item name custom in Dropdown for users chooses its from dropdown another pop-up will appear, and it had some items in form and they filled it up thier details respectively. and click ok then The selected values are returned to grid.
Anyone could known pls help me.
Advance in Thanks
H.AL-MUBARAK
Loading

Mamta MRank #268 · 9.4K reputationPosted Dec 9, 2010, 7:18 PM EST
"Now i need add item name custom in Dropdown for users chooses its from dropdown another pop-up will appear, and it had some items in form and they filled it up thier details respectively."
AL MUBARAK86 reputationPosted Dec 9, 2010, 8:14 PM EST
Hi mamta,
What i mean like, i have a drop down named Templates k. the template drop down had some items has to be filled from database. now i need to add a manual item (i.e) Name - "Custom". still the name custom should be shown in last of dropdown's item. when the user clicks it. a pop-up will appear. The pop-up had some items with checkoxes . when the user wants to check items from pop-up for thier needs. then click ok button has already given in pop-up. The checked values return to appropirate grid.
Are u understand now. k Fine., Could you please help to acheive this? can you give me a sample code?
Advance in Thanks
Madhu KRank #1,514 · 1.1K reputationPosted Dec 9, 2010, 8:45 PM EST
DataRow dr = dt.NewRow();
dr["column_name"] = "Custom";
dt.Rows.Add(dr);
then bind the datatable to dropdown list.
In dropdown selected index changed event check if the selected item is custom then open the popup and the rest of your code.
Hope it helps
AL MUBARAK86 reputationPosted Dec 10, 2010, 12:26 AM EST
Thanks, for quick reply. and i had some doubt about i already get from the data's in DB are stored in dropdown_selectedIndexchanged function name. Then how to i import In dropdown selected index changed event check if the selected item is custom then open the popup and the rest of my code.
Please help to solve this issue with sample code.
Thanks,
CrishRank #1,486 · 1.1K reputationPosted Dec 10, 2010, 12:42 AM EST
You can refer following code for add custom values in dropdown.It will help you.
SqlCmd = New SqlCommand("sp_load_names", SqlCnn) SqlCmd.CommandType = CommandType.StoredProcedure SqlDR = SqlCmd.ExecuteReader() While SqlDR.Read ads_list.Items.Add(New ListItem(SqlDR(1) & "")) End While SqlDR.Close()Madhu KRank #1,514 · 1.1K reputationPosted Dec 10, 2010, 12:44 AM EST
public void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
{
if(DropDownList1.SelectedItem.Text=="Custom")
{
//your code for pop up.
}
}