Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to display the dropdownlist data into gridview by clicking the command button save?
Posted

1 solution

Try this

C#
DataTable dt_ddl = new DataTable();
          dt_ddl.Columns.Add("TextFeild");
          dt_ddl.Columns.Add("ValueFeild");
          for(int i=0;i<ddl.items.count;i++)>
          {
            DataRow dr = dt.NewRow();
            dr[0] = ddl.Items[i].Text;
            dr[1] = ddl.Items[i].Value;
            dt_ddl.Rows.Add(dr);
          }
          GridView1.DataSource=dt_ddl;
          GridView1.DataBind();


All the best
 
Share this answer
 
Comments
brighteyes24 21-Mar-13 13:11pm    
where do i put this codes? is this in a command button event?
Gopinath_Rajan 22-Mar-13 6:06am    
inside command button only
brighteyes24 22-Mar-13 13:07pm    
ok thanks...

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