radbutton as radio button does not work in radgrid editform template

4 posts, 0 answers
  1. Jay
    Jay avatar
    2 posts
    Member since:
    Jun 2013

    Posted 02 Sep 2015 Link to this post

    Radbutton as a radio button does not work (you cannot toggle a set of radio buttons within a group) when placed in an editform template in radgrid.

    They work outside of the radgrid but I need them to work in the radgrid

    Is there something special that needs to be done when inside a template editform in radgrid.

     

  2. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1493 posts

    Posted 07 Sep 2015 Link to this post

    Hi Jay,

    Could you please try to reproduce the issue with the code below and then tell us what changes you have made, so that I can proceed further with the investigation?

    ASPX:
    <telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource" AutoGenerateEditColumn="true">
        <MasterTableView AutoGenerateColumns="false">
            <Columns>
                <telerik:GridTemplateColumn HeaderText="ID">
                    <ItemTemplate>
                        <asp:Label ID="Label1" Text='<%# Eval("SellQuantity")%>' runat="server" />
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadButton ID="RadButton1" runat="server" ButtonType="ToggleButton" ToggleType="Radio" Checked='<%# Eval("IsCheckedFirst")%>' GroupName="group1">
                            <ToggleStates>
                                <telerik:RadButtonToggleState Text="Checked first" Selected="true" />
                                <telerik:RadButtonToggleState Text="UnChecked first" />
                            </ToggleStates>
                        </telerik:RadButton>
                        <telerik:RadButton ID="RadButton2" runat="server" ButtonType="ToggleButton" ToggleType="Radio" GroupName="group1" Checked='<%# !(bool)Eval("IsCheckedFirst")%>'>
                            <ToggleStates>
                                <telerik:RadButtonToggleState Text="Checked second" />
                                <telerik:RadButtonToggleState Text="UnChecked second" />
                            </ToggleStates>
                        </telerik:RadButton>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="SellQuantity" HeaderText="Sell Quantity"></telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>

    C#:
    protected DataTable GetData()
    {
        DataTable dt = new DataTable();
     
        dt.Columns.Add("ID", typeof(int));
        dt.Columns.Add("isCheckedFirst", typeof(bool));
        dt.Columns.Add("SellQuantity", typeof(int));
        dt.Columns.Add("SellDate", typeof(DateTime));
     
        dt.Rows.Add(1, true, 2, new DateTime(2011, 06, 12));
        dt.Rows.Add(2, false, 5, new DateTime(2011, 12, 12));
        dt.Rows.Add(3, false, 6, new DateTime(2012, 06, 17));
        dt.Rows.Add(4, true, 4, new DateTime(2012, 09, 18));
        dt.Rows.Add(5, true, 7, new DateTime(2013, 03, 18));
     
        return dt;
    }
     
    protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        RadGrid1.DataSource = GetData();
    }



    Regards,
    Danail Vasilev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jay
    Jay avatar
    2 posts
    Member since:
    Jun 2013

    Posted 08 Sep 2015 in reply to Danail Vasilev Link to this post

    The problem is with getting the telerik radiobutton to work in the EditForm template.

    Your example works in the editItem template ( I verified this) but unfortunately not in the EditForm template of RadGrid.

     

    <telerik:RadGrid ID="RadGrid1" runat="server" ...>

    <MasterTableView AutoGenerateColumns="False" ... >

    <EditFormSettings EditFormType="Template">

     ...

    </EditFormSettings>

    </MasterTableView>

    </telerik:RadGrid>

     

  5. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1493 posts

    Posted 11 Sep 2015 Link to this post

    Hi Jay,

    I have tried utilizing the edit form template with the radiobutton but once again the scenario works properly on my side:

    ASPX:
    <telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource" AutoGenerateEditColumn="true">
        <MasterTableView AutoGenerateColumns="false">
            <EditFormSettings EditFormType="Template">
                <FormTemplate>
                    <telerik:RadButton ID="RadButton1" runat="server" ButtonType="ToggleButton" ToggleType="Radio" Checked='<%# Eval("IsCheckedFirst")%>' GroupName="group1">
                        <ToggleStates>
                            <telerik:RadButtonToggleState Text="Checked first" Selected="true" />
                            <telerik:RadButtonToggleState Text="UnChecked first" />
                        </ToggleStates>
                    </telerik:RadButton>
                    <telerik:RadButton ID="RadButton2" runat="server" ButtonType="ToggleButton" ToggleType="Radio" GroupName="group1" Checked='<%# !(bool)Eval("IsCheckedFirst")%>'>
                        <ToggleStates>
                            <telerik:RadButtonToggleState Text="Checked second" />
                            <telerik:RadButtonToggleState Text="UnChecked second" />
                        </ToggleStates>
                    </telerik:RadButton>
                </FormTemplate>
            </EditFormSettings>
            <Columns>
                <telerik:GridBoundColumn DataField="ID" HeaderText="ID"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="SellQuantity" HeaderText="Sell Quantity"></telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>

    I would suggest that you provide us with the exact runnable code that reproduces the issue, so that we can investigate it further and provide a solution if possible.

    Regards,
    Danail Vasilev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top