Plz help me to display data on Dropdownlist
-
Hi all I have a problem. Am tring to display data on dropdown list, i have two dropdown list. i'm displaying data on both from database. when the application starts running the first ddl will list out some data. when we select one the second ddl will display data according to that. but here the problem is, when i select one on first ddl, it is automaticaly errasing all the datas..... i havint given any where clear command. y it ts not displaying. the problem i nly when it is connected to database. i tried a sample, it is working. plz help me....
-
Hi all I have a problem. Am tring to display data on dropdown list, i have two dropdown list. i'm displaying data on both from database. when the application starts running the first ddl will list out some data. when we select one the second ddl will display data according to that. but here the problem is, when i select one on first ddl, it is automaticaly errasing all the datas..... i havint given any where clear command. y it ts not displaying. the problem i nly when it is connected to database. i tried a sample, it is working. plz help me....
P_Elza wrote:
i tried a sample, it is working.
Not sure what this means. Have you set breakpoints to see what code is executed ? Best guess is that you're setting the data source on postback, which will clear all viewstate. But that doesn't seem to be exactly what you're describing, do you have a code sample ?
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillionOneHundredAndFortySevenMillionFourHundredAndEightyThreeThousandSixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it )
-
Hi all I have a problem. Am tring to display data on dropdown list, i have two dropdown list. i'm displaying data on both from database. when the application starts running the first ddl will list out some data. when we select one the second ddl will display data according to that. but here the problem is, when i select one on first ddl, it is automaticaly errasing all the datas..... i havint given any where clear command. y it ts not displaying. the problem i nly when it is connected to database. i tried a sample, it is working. plz help me....
Try to debug the application put a break point and see whats happening ? i think after post back the drop down list is not getting populated
Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
-
Hi all I have a problem. Am tring to display data on dropdown list, i have two dropdown list. i'm displaying data on both from database. when the application starts running the first ddl will list out some data. when we select one the second ddl will display data according to that. but here the problem is, when i select one on first ddl, it is automaticaly errasing all the datas..... i havint given any where clear command. y it ts not displaying. the problem i nly when it is connected to database. i tried a sample, it is working. plz help me....
Do you check IsPostBack when you load data collection for ddl? :wtf: You should remember; page_load method works before every event-delegation method (ddl SelectedIndexChanged too).:doh:
we can work IT out! (Beatles)
-
P_Elza wrote:
i tried a sample, it is working.
Not sure what this means. Have you set breakpoints to see what code is executed ? Best guess is that you're setting the data source on postback, which will clear all viewstate. But that doesn't seem to be exactly what you're describing, do you have a code sample ?
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillionOneHundredAndFortySevenMillionFourHundredAndEightyThreeThousandSixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it )
ya i have set but its not entering to
private void DdlCustomer_SelectedIndexChanged(object sender, System.EventArgs e)
even if i change the selection. Code Sampleprivate void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { Production.Add_CustomerToCombo(DdlCustomer,DdlTitle,dgDetailData,SQL_SELECT_CUST_NAME);//CALLING OF THE FUNCTION TO FILL CUSTOMER COMBOBOX } logintime.Text=System.DateTime.Now.ToLongDateString(); BtnSave.Visible=false; } private void DdlCustomer_SelectedIndexChanged(object sender, System.EventArgs e) { BtnSave.Visible=true; DdlTitle.Items.Clear(); DdlTitle.Items.Add(new ListItem("---SELECT---","0")); }
-
ya i have set but its not entering to
private void DdlCustomer_SelectedIndexChanged(object sender, System.EventArgs e)
even if i change the selection. Code Sampleprivate void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { Production.Add_CustomerToCombo(DdlCustomer,DdlTitle,dgDetailData,SQL_SELECT_CUST_NAME);//CALLING OF THE FUNCTION TO FILL CUSTOMER COMBOBOX } logintime.Text=System.DateTime.Now.ToLongDateString(); BtnSave.Visible=false; } private void DdlCustomer_SelectedIndexChanged(object sender, System.EventArgs e) { BtnSave.Visible=true; DdlTitle.Items.Clear(); DdlTitle.Items.Add(new ListItem("---SELECT---","0")); }
OK, then the combobox isn't set up to handle the event, or it's autopostback is not set to true. And, I still think your viewstate is probably off.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillionOneHundredAndFortySevenMillionFourHundredAndEightyThreeThousandSixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it )
-
OK, then the combobox isn't set up to handle the event, or it's autopostback is not set to true. And, I still think your viewstate is probably off.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillionOneHundredAndFortySevenMillionFourHundredAndEightyThreeThousandSixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it )
-
autopostback is set to true and viewstate is on. but i didnt get
Christian Graus wrote:
combobox isn't set up to handle the event
Do one thing override the page init method put the code of populating the drop down in that method so it will populate every time regardless of postback if you don't want to hit the database every time then put all values in session instead and and get vlaues from session or similar to like that
Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "