Hi I have a RadGrid with ObjectDataSource who binds to DataSet Table. It works...my Grid populates correctly. The I have FormTemplate for Updating/Insert new record. There I have 4 different RadComboBox controls.....with i populate with following DataBinding:
what i need is to get/set SelectedIndex or Value on the ComboBox controls based on value in the comparing column in the Grid??
I have read and tried different methods in Telerik Help library but nothing works.....yet.
Any suggestions??
Regards
//Ingimar Andresson
| protected void gwTeam_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| if (!(e.Item is GridEditFormItem) || !e.Item.IsInEditMode) return; |
| var child = e.Item as GridEditFormItem; |
| GridDataItem parent = child.ParentItem; |
| GridColumn col; |
| var season = child.FindControl("cbSeason") as RadComboBox; |
| var teamName = child.FindControl("tbName") as RadTextBox; |
| var playfield = child.FindControl("cbPlayfield") as RadComboBox; |
| var teamleader = child.FindControl("cbTeamLeader") as RadComboBox; |
| var category = child.FindControl("cbCategory") as RadComboBox; |
| if(season == null || teamName == null || playfield == null || teamleader == null || category == null) |
| { |
| Response.Write("Unable to find control"); |
| } |
| else |
| { |
| season.DataSource = dsAsk.Season; |
| season.DataValueField = "SeasonID"; |
| season.DataTextField = "SeasonYear"; |
| season.DataBind(); |
| col = gwTeam.MasterTableView.GetColumnSafe("Säsong"); |
| season.SelectedValue = col.ToString();// parent["Säsong"].Text; |
| teamName.Text = parent["TeamName"].Text; |
| playfield.DataSource = dsAsk.Playfield; |
| playfield.DataValueField = "PlayfieldID"; |
| playfield.DataTextField = "PlayfieldName"; |
| playfield.DataBind(); |
| col = gwTeam.MasterTableView.GetColumnSafe("Spelplan"); |
| playfield.SelectedValue = col.ToString();// parent["Spelplan"].Text; |
| teamleader.DataSource = dsAsk.TeamLeader; |
| teamleader.DataValueField = "TeamLeaderID"; |
| teamleader.DataTextField = "TeamLeaderName"; |
| teamleader.DataBind(); |
| col = gwTeam.MasterTableView.GetColumnSafe("Lagledare"); |
| teamleader.SelectedValue = col.ToString();// parent["Lagledare"].Text; |
| //teamleader.Text = parent["TeamLeaderID"].Text; |
| category.DataSource = dsAsk.TeamCategory; |
| category.DataValueField = "TeamCategoryID"; |
| category.DataTextField = "TeamCategory"; |
| category.DataBind(); |
| col = gwTeam.MasterTableView.GetColumnSafe("Serie"); |
| category.SelectedValue = col.ToString();// parent.DataSetIndex; |
| //category.Text = parent["TeamCategoryID"].Text; |
| } |
| } |
what i need is to get/set SelectedIndex or Value on the ComboBox controls based on value in the comparing column in the Grid??
I have read and tried different methods in Telerik Help library but nothing works.....yet.
Any suggestions??
Regards
//Ingimar Andresson