Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
this is my code where i am binding data to ddl, when i debug the code, it shows all values correctly, but when i run the same, it neither shows any value nor gives Error...


C#
protected void ddlGodownName_SelectedIndexChanged(object sender, EventArgs e)
      {
          if (ddlGodownName.Text!="")
          {
               objLocationMaster.IntMode = 9;
              objLocationMaster.GodawnName = ddlGodownName.Text.Trim();
              DataTable dt = objBAL.getDistinctColumns(objLocationMaster);
              for (int i = 0; i < dt.Rows.Count; i++)
              {
                  ddlrowno.Items.Add(dt.Rows[i]["RowNo"].ToString());
                  ddlcolno.Items.Add(dt.Rows[i]["columnno"].ToString());
                  ddllvlno.Items.Add(dt.Rows[i]["LevelNo"].ToString());
              }
               ddlrowno.Items.Add("Hi");

              //    ddlrowno.DataTextField = "RowNo";
              //ddlrowno.DataValueField = "RowNo";
              //ddlrowno.DataBind();

              //ddlcolno.DataSource = dt;
              //ddlcolno.DataTextField = "columnno";
              //ddlcolno.DataValueField = "columnno";
              //ddlcolno.DataBind();

              //ddllvlno.DataSource = dt;
              //ddllvlno.DataTextField = "LevelNo";
              //ddllvlno.DataValueField = "LevelNo";
              //ddllvlno.DataBind();
          }
      }
Posted
Comments
Sergey Alexandrovich Kryukov 18-Oct-14 1:32am    
It means that you are looking in wrong place with the debugger. You need to inspect values in your drop-down list.
—SA
Rajesh waran 18-Oct-14 2:15am    
check your ddlGodownName AutoPostBack property is set to true.

do you have any update panels .................check your update panels update panels some time do like this
 
Share this answer
 
v3
Comments
Madhuri Gamane 18-Oct-14 8:01am    
Wow.. thank you yaar....
.
it works, there was a update panel for ddlgodawnName
Check whether the AutoPostBack property is set on or not. If it is set off then it will not fire the event.
 
Share this answer
 
Can you confirm, if the autopostback property of ddlGodownName is set as true.
 
Share this answer
 
v2
Comments
Rajesh waran 18-Oct-14 2:19am    
hi,@NaibedyaKar (Mindfire),
@Madhuri Gamane wrote code on ddlGodownName_selectedindexchanged, so checking AutoPostBack property in ddlGodownName is right way,not to check ddllvlno.
NaibedyaKar 18-Oct-14 2:24am    
Ohh yes, Gopu, you are right. My bad.
Sorry Madhuri. Please check ddlGodownName is having the autopostback is set to true or not.

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