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

Edit Mode RadButton ToggleType=Radio not working value display Unchecked

6 Answers 146 Views
Button
This is a migrated thread and some comments may be shown as answers.
Jyosana
Top achievements
Rank 1
Jyosana asked on 18 Sep 2013, 10:42 AM

Hello All
I have a Issue with the RadButton ToggleType="Radio" buttons. In Insert Mode Radio Button Selected Value Save Data is Properly
but When I Edit Mode and I Press My Edit  Button Then RadButton Selected Value is Unchecked

 

 

<table>
           <tr>
               <td valign="top" align="right">
                   <asp:Label ID="lblSchedule" runat="server" CssClass="labelText" Text="Schedule: "></asp:Label>
               </td>
               <td valign="top" align="left" colspan="3">
                   <telerik:RadButton ID="rdEmployer1" runat="server" ButtonType="ToggleButton" GroupName="Schedule" ToggleType="Radio" AutoPostBack="false" Text="Mon" Value="1"></telerik:RadButton>
                   <telerik:RadButton ID="rdEmployer2" runat="server" ButtonType="ToggleButton" GroupName="Schedule" ToggleType="Radio" AutoPostBack="false" Text="Tue" Value="2"></telerik:RadButton>
                   <telerik:RadButton ID="rdEmployer3" runat="server" ButtonType="ToggleButton" GroupName="Schedule" ToggleType="Radio" AutoPostBack="false" Text="Wed" Value="3"></telerik:RadButton>
                   <telerik:RadButton ID="rdEmployer4" runat="server" ButtonType="ToggleButton" GroupName="Schedule" ToggleType="Radio" AutoPostBack="false" Text="Thr" Value="4"></telerik:RadButton>
                   <telerik:RadButton ID="rdEmployer5" runat="server" ButtonType="ToggleButton" GroupName="Schedule" ToggleType="Radio" AutoPostBack="false" Text="Fri" Value="5"></telerik:RadButton>
                   <telerik:RadButton ID="rdEmployer6" runat="server" ButtonType="ToggleButton" GroupName="Schedule" ToggleType="Radio" AutoPostBack="false" Text="Sat" Value="6"></telerik:RadButton>
               </td>
           </tr>
       </table>
       protected void btnEmployerEdit_Click(object sender, EventArgs e)
       {
             DataSet dsEmploerList = General.General.objService.GetEmployerBYID(Convert.ToInt32(EmployerPK);
             if (dsEmploerList != null && dsEmploerList.Tables.Count > 0 && dsEmploerList.Tables[0].Rows.Count > 0)
               {
                   if (Convert.ToString(dsEmploerList.Tables[0].Rows[0]["Schedule"]) == "1")                   
                       rdEmployer1.Checked = true; 
                   if (Convert.ToString(dsEmploerList.Tables[0].Rows[0]["Schedule"]) == "2")
                       rdEmployer2.Checked = true;
                   if (Convert.ToString(dsEmploerList.Tables[0].Rows[0]["Schedule"]) == "3")
                       rdEmployer3.Checked = true;
                   if (Convert.ToString(dsEmploerList.Tables[0].Rows[0]["Schedule"]) == "4")
                       rdEmployer4.Checked = true;
                   if (Convert.ToString(dsEmploerList.Tables[0].Rows[0]["Schedule"]) == "5")
                       rdEmployer5.Checked = true;
                   if (Convert.ToString(dsEmploerList.Tables[0].Rows[0]["Schedule"]) == "6")
                       rdEmployer6.Checked = true;
                   if (Convert.ToString(dsEmploerList.Tables[0].Rows[0]["Schedule"]) == "")
                       rdEmployer1.Checked = rdEmployer2.Checked = rdEmployer3.Checked = rdEmployer4.Checked = rdEmployer5.Checked = rdEmployer6.Checked = false;
               }
       }
 
     protected void btnEmployerSave_Click(object sender, EventArgs e)
       {
           string Scheduler = string.Empty;
           if (rdEmployer1.Checked == true)
               Scheduler = "1";
           if (rdEmployer2.Checked == true)
               Scheduler = "2";
           if (rdEmployer3.Checked == true)
               Scheduler = "3";
           if (rdEmployer4.Checked == true)
               Scheduler = "4";
           if (rdEmployer5.Checked == true)
               Scheduler = "5";
           if (rdEmployer6.Checked == true)
               Scheduler = "6";
 
           if (EmployerPK > 0)
           {
               EmployerPK = General.General.objService.UpdateEmployer(EmployerPK, Scheduler);
           }
           else
           {
               EmployerPK = General.General.objService.InsertEmployer(Scheduler);
           }        
       }

 

 

 

6 Answers, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 23 Sep 2013, 09:37 AM
Hello Jyosana,

It seems that there is an issue with setting the server-side checked property to RadButton (ButtonType="ToggleButton" ToggleType="Radio"). I have logged the unexpected behavior in our feedback portal here, so that you can monitor, comment or raise its priority by voting on it.

For the time being you can execute JavaScript from the server which sets this property. For example:
string script = "";
if (Convert.ToString(dsEmploerList.Tables[0].Rows[0]["Schedule"]) == "1")
    script = "function f(){$find(\"" + rdEmployer1.ClientID + "\").set_checked(true); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
ScriptManager.RegisterStartupScript(this, this.GetType(), "key", script, true);

You can find a modified version of your example with the above approach in the attached archive.

As a small token of gratitude for reporting this issue to us, I have updated your Telerik points.

Regards,
Danail Vasilev
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Jyosana
Top achievements
Rank 1
answered on 23 Sep 2013, 11:48 AM
Hello, Danail Vasilev
Thanks for your replay
Your Code is Working Fine and my issue is resolved
Thank you very much

Thanks
Jyosana
0
Steve
Top achievements
Rank 1
answered on 03 Dec 2013, 12:00 AM
When is this going to be fixed? I have well over 200 of these types of buttons grouped all over my site that are set server-side. This is a critical issue for me! I can't implement your "workaround". I need this fixed ASAP!
0
Danail Vasilev
Telerik team
answered on 05 Dec 2013, 10:28 AM
Hi Steve,

I have raised the priority of this item and escalated it to the attention of our developers. If everything is fine the issue will be fixed for Q1 2014.

Regards,
Danail Vasilev
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Steve
Top achievements
Rank 1
answered on 05 Dec 2013, 01:21 PM
I have another issue I wrote about in this forum that they can look at as well and hopefully resolve.

Other issue located here:  Checkbox and image button issue
0
Yasha
Top achievements
Rank 1
answered on 22 Mar 2017, 06:51 PM

Hi I have two sets of Standard button with ToggleType = "Radio" as below

<telerik:RadButton ID="btnCreSpec" runat="server" RenderMode="Lightweight" ButtonType="StandardButton" ToggleType="Radio" Text="Create Spec" GroupName="SpecItemLink" BorderColor="Gray" AutoPostBack="false"  />
<telerik:RadButton ID="btnLnkToSpec" runat="server" RenderMode="Lightweight" ButtonType="StandardButton" ToggleType="Radio" Text="Link to Spec" GroupName="SpecItemLink"  BorderColor="Gray" AutoPostBack="false"  />
<telerik:RadButton ID="btnLnkToItem" runat="server" RenderMode="Lightweight" ButtonType="StandardButton" ToggleType="Radio" Text="Link to Item" GroupName="SpecItemLink"  BorderColor="Gray" AutoPostBack="false" />

<telerik:RadButton ID="rbInside" runat="server" RenderMode="Lightweight" ButtonType="StandardButton" ToggleType="Radio" Text="Inside" GroupName="JointLoc"  BorderColor="Gray" AutoPostBack="false"  />
<telerik:RadButton ID="rbOutside" runat="server" RenderMode="Lightweight" ButtonType="StandardButton" ToggleType="Radio" Text="Outside" GroupName="JointLoc"  BorderColor="Gray" AutoPostBack="false" />
<telerik:RadButton ID="rbNone" runat="server" RenderMode="Lightweight" ButtonType="StandardButton" ToggleType="Radio" Text="None" GroupName="JointLoc"  BorderColor="Gray" AutoPostBack="false" />

And I implemented Script as a fix which is mentioned in this post as in attached file. But Only second Set gets button selected. For first set nothing is getting selected.  Does anybody have a solution for this?

Tags
Button
Asked by
Jyosana
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Jyosana
Top achievements
Rank 1
Steve
Top achievements
Rank 1
Yasha
Top achievements
Rank 1
Share this question
or