how do i bind the dropdownlist in insert or edit mode and then how the Update or Insert command will find the control...
i tried a lot didnt worked
here is the code
and i want when i click add new record the state should be binded in dropdownlist...
i tried a lot didnt worked
here is the code
protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { SqlDataAdapter da = new SqlDataAdapter("select c.City, s.State from MST_State as s inner join MST_City as c on c.StateID = s.ID ", con); DataTable mydatatable = new DataTable(); da.Fill(mydatatable); RadGrid1.DataSource = mydatatable.DefaultView; } //protected void RadGrid1_InsertCommand(object sender, GridCommandEventArgs e) //{ // //} protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e) { //GridEditableItem editedItem = e.Item as GridEditableItem; //UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID); GridEditFormInsertItem inserteditem = (GridEditFormInsertItem)e.Item; //Create new row in the DataSource //Insert new values string City = (inserteditem["City"].Controls[0] as TextBox).Text; DropDownList list = (inserteditem.FindControl("State") as DropDownList); string State = list.SelectedValue; con.Open(); string insertquery = String.Format("insert into MST_City values('{0}', '{1}')", City, State); SqlCommand sql = new SqlCommand(); sql.CommandText = insertquery; sql.Connection = con; sql.ExecuteNonQuery(); con.Close(); }and i want when i click add new record the state should be binded in dropdownlist...