I'm using dev express with asp.net on a project that requires a radio button and dropdownlist in ASPxGridView. I use the radio button in the edit form. When I save the <insertparameter>
in <asp:objectdatasource>
throws a null value.
<dx:ASPxGridView ID="gvEmp" ClientInstanceName="gvEmp" runat="server"
Width="100%" KeyFieldName="Emp_id" AutoGenerateColumns="false">
<columns>
<dx:GridViewDataTextColumn Caption="Gender" ShowInCustomizationForm="true"
FieldName="Gender"> </dx:GridViewDataTextColumn>
</columns>
<editform>
<dx:ASPxRadioButtonList ID="Gender1" AutoPostBack="false" runat="server"
Value='<%# Eval("Gender") %>' ValueType="System.String">
<Items>
<dx:ListEditItem Text="Male" Value="Male" Selected="true"/>
<dx:ListEditItem Text="Female" Value="Female" />
</Items>
</dx:ASPxRadioButtonList>
</editform>
</dx:ASPxGridView>
<asp:ObjectDataSource ID="ObjectDSEmployee" runat="server"
InsertMethod="InsertEmployee"
TypeName="solution.file1.DataAccess.InspectionDataAccess">
<InsertParameters>
<asp:Parameter Name="Gender" Type="String"/>
</InsertParameters>
</asp:ObjectDataSource>
The Object Data Source Passes a null value to the InsertEmployee method.
I found the answer. I used Eval() instead of Bind() in the Radio Button. After I changed it works properly.