I have a grid with a GridDropDownColumn. EditMode is "InPlace". On Insert I want to access the GridDropDownColumn...no problem there..but when the Grid is in Edit mode I want to disable the dropdown. How do I go about doing this?
Thanks,
Larry
Thanks,
Larry
5 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 30 Jun 2010, 05:45 AM
Hello Larry,
You can try the following code snippet to disable the DropDownColumn in Editmode when the EditMode is InPlace.
ASPX:
C#:
Thanks,
Princy.
You can try the following code snippet to disable the DropDownColumn in Editmode when the EditMode is InPlace.
ASPX:
<telerik:GridDropDownColumn DropDownControlType="DropDownList" UniqueName="GridDropDownColumn" HeaderText="GridDropDownColumn"> |
</telerik:GridDropDownColumn> |
C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
if (!(e.Item is GridDataInsertItem) && e.Item.IsInEditMode) |
{ |
GridEditableItem editItem=(GridEditableItem)e.Item; |
DropDownList drList = (DropDownList)editItem["GridDropDownColumn"].Controls[0]; |
drList.Enabled = false; |
} |
} |
Thanks,
Princy.
0

Larry
Top achievements
Rank 1
answered on 30 Jun 2010, 02:56 PM
Thanks Princy. That worked fine.
0

Ravi Kumar Kamboj
Top achievements
Rank 1
answered on 11 Nov 2010, 07:31 AM
Please tell me how control added in edit template
and
How Edit Mode="In Place" work .
Please provide me .aspx and .cs file for this...
or provide me the full functionality of this task whose link is link below.
http://www.telerik.com/help/aspnet-ajax/grdeditmodeinplace.html
Thanks in Advance
and
How Edit Mode="In Place" work .
Please provide me .aspx and .cs file for this...
or provide me the full functionality of this task whose link is link below.
http://www.telerik.com/help/aspnet-ajax/grdeditmodeinplace.html
Thanks in Advance
0

Shinu
Top achievements
Rank 2
answered on 11 Nov 2010, 08:27 AM
Hello Ravi,
For accessing any control placed in template field, use the FindControl() method of the GridItem. The sample will help you.
Code:
And the mark-up is:
Also, go through the documentation: Distinguish edit/insert mode on ItemCreated/ItemDataBound
-Shinu.
For accessing any control placed in template field, use the FindControl() method of the GridItem. The sample will help you.
Code:
protected
void
RadGrid1_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(!(e.Item
is
GridDataInsertItem) && e.Item.IsInEditMode)
{
GridEditableItem editItem = (GridEditableItem)e.Item;
DropDownList drList = (DropDownList)editItem.FindControl(
"DropDownList1"
);
drList.Enabled =
false
;
}
}
And the mark-up is:
<
telerik:GridTemplateColumn
HeaderText
=
"EditTemplate"
>
<
EditItemTemplate
>
<
asp:DropDownList
ID
=
"DropDownList1"
runat
=
"server"
>
</
asp:DropDownList
>
</
EditItemTemplate
>
<
ItemTemplate
>
. . .
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
Also, go through the documentation: Distinguish edit/insert mode on ItemCreated/ItemDataBound
-Shinu.
0

Ravi Kumar Kamboj
Top achievements
Rank 1
answered on 11 Nov 2010, 08:30 AM
Thanks for reply.
But how dropdown contols show in grid view, means that how grid goes in Edit State..
But how dropdown contols show in grid view, means that how grid goes in Edit State..