i ve griddropdowncolumn and gridbound columns on my radgrid
while selecting the value from dropdown i need to bind values on bound columns n also i want to make some bound columns read only true on the selected index changes event
i can able to fetch values to bound columns but couldnt make it as non editable .
dynamically i want to set ,for some scenarios i need to make them as non editable ,n for some it shd be editable for that
only am not setting those properties on source
thanks in advance
while selecting the value from dropdown i need to bind values on bound columns n also i want to make some bound columns read only true on the selected index changes event
<telerik:radgrid ID="RadGrid1" runat="server" Height="300" Visible="true" BackColor="LightBlue" ShowFooter="true" PageSize="20" AllowPaging="True" AllowFilteringByColumn="True" AllowSorting="true" ShowStatusBar="true" GridLines="None" AutoGenerateColumns="False" Skin="Vista" OnPreRender="RadGrid1_PreRender" OnItemDataBound ="RadGrid1_ItemDataBound" OnItemCreated="RadGrid1_ItemCreated" OnNeedDataSource="RadGrid1_NeedDataSource" OnColumnCreated="RadGrid1_ColumnCreated" > |
<MasterTableView CommandItemDisplay="Top" AutoGenerateColumns="false" AllowFilteringByColumn="True" AllowSorting="true" > |
<ExpandCollapseColumn><HeaderStyle Width="20px"></HeaderStyle></ExpandCollapseColumn> |
<RowIndicatorColumn><HeaderStyle Width="20px" /></RowIndicatorColumn> |
<ExpandCollapseColumn><HeaderStyle Width="20px" /></ExpandCollapseColumn> |
<Columns> |
<%-- <telerik:GridDropDownColumn DataField="a" HeaderText="a" UniqueName="a" />--%> |
<telerik:GridDropDownColumn DataField="a" HeaderText="a" UniqueName="a" ListTextField="a" ListValueField="a" DataSourceID="SqlDataSource1"/> |
<telerik:GridBoundColumn DataField="b" HeaderText="b" UniqueName="b" /> |
<telerik:GridBoundColumn DataField="c" HeaderText="c" UniqueName="c" /> |
<telerik:GridBoundColumn DataField="d" HeaderText="d" UniqueName="d" /> |
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) |
{ |
if (e.Item is GridEditFormItem && e.Item.IsInEditMode) |
{ |
string[] strArray = { "a", "e"}; |
GridEditFormItem item = (GridEditFormItem)e.Item; |
for (int k = 0; k < 2; k++) |
{ |
GridDropDownListColumnEditor editor = (GridDropDownListColumnEditor)item.EditManager.GetColumnEditor(strArray[k]); |
editor.DataSource = (DataSet)Session["sesds"]; |
editor.DataTextField = strArray[k]; |
editor.DataValueField = strArray[k]; |
editor.DataBind(); |
editor.ComboBoxControl.AutoPostBack = true; |
editor.ComboBoxControl.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(ComboBoxControl_SelectedIndexChanged); |
} |
} |
} |
protected void ComboBoxControl_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) |
{ |
try |
{ |
//string ElementID = Convert.ToString((sender as RadComboBox).SelectedItem.Text); |
RadComboBox rad = (RadComboBox)o; |
GridEditableItem editedItem = (GridEditableItem)(o as RadComboBox).NamingContainer; |
GridEditManager editMan = editedItem.EditManager; |
foreach (GridColumn column in RadGrid1.MasterTableView.RenderColumns) |
{ |
if (column is IGridEditableColumn) |
{ |
IGridEditableColumn editableCol = (column as IGridEditableColumn); |
if (editableCol.IsEditable) |
{ |
IGridColumnEditor editor = editMan.GetColumnEditor(editableCol); |
if (editor is GridTextColumnEditor) |
{ |
if ( rad.ID.ToLower() == "rcb_a") |
{ |
if (column.UniqueName == "b") |
{ |
(editor as GridTextColumnEditor).Text = "Done"; |
} |
else if (column.UniqueName == "c") |
{ |
(editor as GridTextColumnEditor).Text = "ok"; |
} |
else if (column.UniqueName == "d") |
{ |
(editor as GridTextColumnEditor).Text = "ok1"; |
} |
} |
if (rad.ID.ToLower() == "rcb_e") |
{ |
if (column.UniqueName == "f") |
{ |
(editor as GridTextColumnEditor).Text = "Done2"; |
} |
else if (column.UniqueName == "g") |
{ |
(editor as GridTextColumnEditor).Text = "ok2"; |
} |
else if (column.UniqueName == "h") |
{ |
(editor as GridTextColumnEditor).Text = "ok3"; |
(editor as GridTextColumnEditor).Visible = false; |
} |
} |
} |
} |
} |
} |
} |
catch |
{ |
} |
} |
i can able to fetch values to bound columns but couldnt make it as non editable .
dynamically i want to set ,for some scenarios i need to make them as non editable ,n for some it shd be editable for that
only am not setting those properties on source
thanks in advance