Skip to content

How to get selected value of datagrid dropdownlist

karthikeyan muthusamy

Asked Jun 28, 2006, 3:41 AM EDT2 answers
Share
LinkedInX
hi i have drop down list in mydatagrid. and i loaded my database values in that and if i select any value from that dropdownlist it has to be shown in my textbox wthich is some where in my page.i want to do in servevr side. i am using c# asp.net so tell me the coding.

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    if u select some thing from that drop-down list
    it will return the selectedindex for u r selection
    this is the syntax:
     formname.comboboxname.selectedindex

    take that value and use that index based on u r req.
    0
  • 0
    Here is the way, you can get the value selected in a dropdownlist embedded on a Datagrid:


    ----Code--------

    DropDownList DDLCtrl=(DropDownList)DataGrid1.Item[index].Cells[index].Controls[index];

    //For e.g DropDownList DDLCtrl=(DropDownList)DataGrid1.Item[0].Cells[1].Controls[1];

    Response.Write(DDLCtrl.SelectedItem.Text);


    hope solved ur problem

    0