This is a migrated thread and some comments may be shown as answers.

ItemDataBound

3 Answers 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Eva
Top achievements
Rank 1
Eva asked on 19 Aug 2011, 12:39 AM
I have dropdown list edit template column

<EditFormSettings

 

 

EditFormType="Template">

 

 

 

<FormTemplate>

 

 

 

<table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="0" rules="none"

 

 

 

style="border-collapse: collapse; background: white;">

 

 

 

<tr class="EditFormHeader">

 

 

 

<td colspan="2" style="font-size: small">

 

 

 

<b>Act</b>

 

 

 

</td>

 

 

 

<td>

 

 

 

<asp:DropDownList ID="ddlAct" AutoPostBack="true" runat="server" DataValueField="Id" OnSelectedIndexChanged="ddlAct_SelectedIndexChanged"

 

 

 

DataTextField="Act" SelectedValue='<%# Bind("Id") %>' TabIndex="7" AppendDataBoundItems="True" >

 

 

 

<asp:ListItem Selected="True" Text="Select" Value=""></asp:ListItem>

 

 

 

</asp:DropDownList>

 

 

 

 

</td>

 

 

 

</tr>

 

 

 

<tr class="EditFormHeader">

 

 

 

<td colspan="2" style="font-size: small">

 

 

 

<b>42 CFR</b>

 

 

 

</td>

 

 

 

<td>

In itemdatabound, it doesn't hit the

 

if ((e.Item is GridDataItem) && e.Item.IsInEditMode)

 

 

 

here is the code

 

 

 

protected void rd_ItemDataBound(object sender, GridItemEventArgs e)

 

{

// if (e.Item is GridEditableItem && e.Item.IsInEditMode)

 

 

if ((e.Item is GridDataItem) && e.Item.IsInEditMode)

 

{

 

 

GridEditableItem edititem = (GridEditableItem)e.It


What i'm missing here?

 

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 19 Aug 2011, 04:49 AM
Hello Eva,

Try the following code snippet to achieve your scenario.
C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
 {
        if (e.Item is GridEditableItem && e.Item.IsInEditMode)
        {
            GridEditableItem item = (GridEditableItem)e.Item;
            DropDownList drp = (DropDownList)item.FindControl("ddlact");
        }
 }

Thanks,
Princy.
0
Eva
Top achievements
Rank 1
answered on 19 Aug 2011, 06:23 PM


Still it's not firing.
I tried

if

 

 

(e.Item is GridEditableItem && e.Item.IsInEditMode)

 


always e.item.isineditmode is false, even in edit mode.

Need help ASAP.

0
Jayesh Goyani
Top achievements
Rank 2
answered on 19 Aug 2011, 07:37 PM
Hello,

If possible then please provide code. because i am not able to generate such type of problem.

Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Eva
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Eva
Top achievements
Rank 1
Jayesh Goyani
Top achievements
Rank 2
Share this question
or