I have a DropDownList that appears when my RadGrid is in edit mode or insert mode.
<radG:GridTemplateColumn DataField="Covering" HeaderText="Covering"
UniqueName="Covering" SortExpression="Covering" >
<ItemTemplate>
<asp:Label ID="lblCovering" runat="server" Text='<%# Eval("Covering") %>' />
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID="lblCovering2" runat="server" Text='<%# Eval("Covering") %>' Visible="false" />
<asp:Textbox ID="txtCovering" runat="server" Text='<%# Eval("Covering") %>' Visible="false" />
<asp:DropDownList ID="ddCovering" OnSelectedIndexChanged="ddCovering_SelectedIndexChanged" runat="server" AutoPostBack="true" Visible="True" />
</EditItemTemplate>
</radG:GridTemplateColumn>
As you can see, my dropdownlist has an autopostback set to true and is run by the event called ddCovering_SelectedIndexChanged. Within the SelectedIndexChanged Event, the dropdown will change to a textbox based on what the user selects from the dropdownlist WHILE THE RADGRID is in Edit mode. Here is the code below that drives that event....
Protected Sub ddCovering_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
For Each item As GridDataItem In RadGrid_NoReferrals.EditItems
Dim ddCovering As DropDownList = DirectCast(sender, DropDownList)
Dim txtCovering As TextBox = DirectCast(item.FindControl("txtCovering"), TextBox)
If ddCovering.SelectedValue = Nothing Then
ddCovering.Visible = False
txtCovering.Visible = True
End If
Next
End Sub
My only problem is that this only happens when the RadGrid is in Edit mode, but not when its in Insert Mode. I need the DropDownBox to also change to a Textbox in Insert Mode as well. How would I go about doing this....? Please Help!
<radG:GridTemplateColumn DataField="Covering" HeaderText="Covering"
UniqueName="Covering" SortExpression="Covering" >
<ItemTemplate>
<asp:Label ID="lblCovering" runat="server" Text='<%# Eval("Covering") %>' />
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID="lblCovering2" runat="server" Text='<%# Eval("Covering") %>' Visible="false" />
<asp:Textbox ID="txtCovering" runat="server" Text='<%# Eval("Covering") %>' Visible="false" />
<asp:DropDownList ID="ddCovering" OnSelectedIndexChanged="ddCovering_SelectedIndexChanged" runat="server" AutoPostBack="true" Visible="True" />
</EditItemTemplate>
</radG:GridTemplateColumn>
As you can see, my dropdownlist has an autopostback set to true and is run by the event called ddCovering_SelectedIndexChanged. Within the SelectedIndexChanged Event, the dropdown will change to a textbox based on what the user selects from the dropdownlist WHILE THE RADGRID is in Edit mode. Here is the code below that drives that event....
Protected Sub ddCovering_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
For Each item As GridDataItem In RadGrid_NoReferrals.EditItems
Dim ddCovering As DropDownList = DirectCast(sender, DropDownList)
Dim txtCovering As TextBox = DirectCast(item.FindControl("txtCovering"), TextBox)
If ddCovering.SelectedValue = Nothing Then
ddCovering.Visible = False
txtCovering.Visible = True
End If
Next
End Sub
My only problem is that this only happens when the RadGrid is in Edit mode, but not when its in Insert Mode. I need the DropDownBox to also change to a Textbox in Insert Mode as well. How would I go about doing this....? Please Help!