Solved

RadioButton in TemplateColumn

Posted on 2006-06-09
4
1,091 Views
Last Modified: 2008-02-01
I have created a template column in my web datagrid and draged and dropped 1 radiobutton control into it.
I have called the groupname "qqq"

However when i run it the radiobutton column does not function as a radiobuttonList for some reason?
any ideas?

I am using c# vs2005
0
Comment
Question by:joshuadavidlee
  • 2
4 Comments
 
LVL 4

Expert Comment

by:BradB3030
Comment Utility
Do you have a pointer in your Code Behind to the Event handler.

I used to use VB.NET, but there should be something similar to this:

Then, I think you should use your ItemDataBound subroutine.  Put OnItemDataBound = "DataGrid1_ItemDataBound"  into your datagrid tag in HTML source and then create the DataGrid1_ItemDataBound sub to handle that event

then you can read the radiobutton there if you have its name ....  if e.item.cells(2).FindControl("radioButton1").  <<-- if it's in cell 2, that's how you access the radiobutton stuff...

Hope this helps and I hope I don't confuse you with my VB background!
0
 

Author Comment

by:joshuadavidlee
Comment Utility
Ok so i wrote some code to test the groupnames after the grid was databound like this:

        foreach (GridViewRow gr in this.GridView1.Rows)
        {
            RadioButton rb = (RadioButton)gr.Cells[0].FindControl("RadioButton1");
            string theGroupName = rb.GroupName;
        }

and they all had the same groupname which is good, and also i drew 3 other radio buttons on my page with the same groupname and they worked fine, its just the one sin the gridview that are not working like a radiobuttonlist.

is there some setting i have to change for them to work in a gridview?
0
 
LVL 16

Expert Comment

by:Edwin_C
Comment Utility
0
 
LVL 16

Accepted Solution

by:
Edwin_C earned 500 total points
Comment Utility
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now