.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to check a radiobutton just by clicking the gridview row

Posted By:      Posted Date: October 04, 2010    Points: 0   Category :ASP.Net

Hi guys.

I've a gridview with 3 columns. 2 are boundfiels and 1 itemTemplate (radiobutton)

<asp:GridView ID="GridViewMoveType" runat="server" CellPadding="4" AllowPaging="True" PagerStyle-BackColor="White" PageSize="15" Width="100%" HeaderStyle-BackColor="White" HorizontalAlign="Left" CssClass="rowodd" AutoGenerateColumns="False" GridLines="None" DataKeyNames="MoveTypeID">
                    <AlternatingRowStyle HorizontalAlign="Left" CssClass="roweven" VerticalAlign="Top" />
                         <asp:BoundField DataField="MoveTypeID" HeaderStyle-Width="5%" ItemStyle-HorizontalAlign="Right" ControlStyle-CssClass="itemAlign" InsertVisible="False" Visible="true" />
                         <asp:BoundField DataField="MoveTypeLongDescr" HeaderStyle-Width="95%" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" SortExpression="InputLongDescr" />

View Complete Post

More Related Resource Links

Check All with JQuery and a Asp.Net GridView

Display a Grid on the screen with a checkbox in each row. At the bottom of the page have "Check All" button.

Typically if I need to do anything interesting I use a template column. So my GridView will look like the one below (most other columns removed for readability). The only interesting point to note is the CssClass="ApprovalCheckBox" in the CheckBox ItemTemplate.

RadioButton inside GridView, How to get it work as normal

Did you tried before to drag a RadioButton control inside a Gridivew templatefield, and then you attempt to select these RadioButtons , you will notice that the behavior of RadioButton control will be changed and it will work just like the behavior of checkbox control! the user will be able to select more than one radiobutton in the grid!

Disable check box in a gridview does not working



I have a check box in a template field in a gridview.

Based on some condition, I want those check boxs to  be enable and disable.

I am trying the below code but does working..

 protected void GVstudents_RowDataBound(object sender, GridViewRowEventArgs e)
              if (e.Row.RowType == DataControlRowType.DataRow)
                    string studentID = GVstudents.DataKeys[0].Value.ToString();
                    int stdID = Convert.ToInt32(studentID);
                    int schID = profile.getSchoolIDByStudentID(stdID);
                    int tchrID = profile.getTeacherIDByStudentID(stdID);

                    if (patti.chkIsTeacherPaid(stdID, schID, tchrID))
                        CheckBox cb = (CheckBox)e.Row.FindControl("chkTeacherPayment");
                        cb.Enabled = false;
                        cb.Checked = true;


any help??

Gridview check all not working in Mozila Firefox


hi all,

i has an gridview first column header is Checkbox, when i click on that all the detail column checkboxes were selected if i use IE but the same not working in Mozila Firefox

below is my code

function checkAll()
                  var totalChkBoxes = parseInt('<%= gv5.Rows.Count %>');
                  var gvControl = document.getElementById('<%= gv5.ClientID %>');
                  var gvChkBoxControl = "cbCheckProd";
                  var mainChkBox = document.getElementById("chkBoxAll");
                  var inputTypes = gvControl.getElementsByTagName("input");
                  for (var i = 0; i < inputTypes.length; i++)

Get the value of radiobutton from Gridview

I have Gridview with three server-side radio buttons in each row. How will I be able to get the value of the row of the selected radio button?

gridview check box validation using js



i'm using a gridview with checkboxes.i want to validate if checkbox is checked or not on button click event.based on that i've to display a message.for that i used th following function.but it's not working.

function check() {
            var grid = document.getElementById("<%grdOrgRes.ClientID %>");
            if (grid.rows.length > 0) {
                for (i = 1; i < grid.rows.length; i++) {
                    cell = grid.rows[i].cells[0];
                    for (j = 0; j < cell.childNodes.length; j++) {
                        if (cell.childNodes[j].type == "checkbox") {
                            if (cell.childNodes[j].checked==false) {

GridView Insert clicking a button in footer row using stored procedure


Hi!! I need your help again.

I have a gridview with a button in the first column of the footer row and some controls (textbox, dropdowlist...) in the rest of the columns. I want to click that button and insert into a database table using an stored procedure the text properties of the controls in the other columns.

I don't know what's wrong... could you help me or post me a link to read it??

I'm setting the insert command with my stored procedure, I'm setting the storedprocedure as the insertcommandtype, I'm able to load the controls with correct values, but finally when I click the insert button that's not work!!!!

Thank you!!!

Gridview Check box and Parse()



Documentation for using a checkbox with a gridview has the following statement:


Because a check box can display only a selected or an unselected state, a CheckBoxField object can be bound only to a field with a Boolean data type or a string that can be parsed by Parse.


No example has yet been found to explain how using Parse to control the value of theis done.  Interestingly enough I can find a fine example for the unlikely scenario of embedding a bulleted list in a grid cell. 

How can get a Y/N (or Y/blank) value into the checkbox field?

Clicking a GridView hyperlink to go to another WizardStep


Within a WizardStep in the AccountManagement.aspx page, I have the following Gridview:

                            <asp:GridView ID="GridViewUserAccounts" 
                                <AlternatingRowStyle BackColor="#EEEEEE" />
                                    <asp:HyperLinkField DataNavigateUrlFields="UserName" DataTextField="UserName" 
                                        HeaderText="User ID" />
                                    <asp:BoundField DataField="Email" HeaderText="Email" />

When a UserName HyperLinkField is clicked, I want to go to the another WizardStep.

With DataNavigateUrlFormatString="AccountManagement.aspx?user={0}, I think the page

gridview with radiobutton


HI, In my page i have gridview with radiobutton. The grid is completely binded with data.I use radibutton for selecting one particular row inside the gridview.In runtime i am able to choose multiple radiobutton before the first choosen one function finishes.User will be allow to choose any radiobutton he wants.I want to keep like this if he chooses first radio button till the whole selected index changed gets end and row gets highlighted he should not be able to choose any other radiobutton till the first one ends. Thanks All. Thanks Venkat

Select Row on GridView by Clicking Next button



         I have a button called Next outside the GridView. If I click on Next, I want to highlite the 2nd row and display the details of the 2nd row below in panel. If again I click on Nextm i want to highlite 3rd row and want to display 3rd row results in a panel


How to check CheckBox.IsChecked property if CheckBox is in header of ListView/GridView with grouping


Sorry for this difficult title :P

So what exactly I need? I will try to explain it step by step as easy as possible.
My question is on the end of this post, but to understand my issue is better to read all steps.

First have a look on this post http://msdn.microsoft.com/en-us/library/ms754027(v=VS.90).aspx

1) I am implementing allmost the same code. 
But I changed one TextBlock (in Expander.Header) for a CheckBox:

<ListView x:Name="ExampleListView"
 ItemsSource="{Binding Source={StaticResource Src}}"

 <GridViewColumn DisplayMemberBinding="{Binding Path=PropertyOne}" Header="One" />
 <GridViewColumn DisplayMemberBinding="{Binding Path=PropertyTwo}" Header="Two" />


How do i pop up datas to ajax modalpopup extender just by clicking on the row in gridview?


How do i pop up datas to ajax modalpopup extender just by clicking on the row in gridview?

i have to get only the selected row to the pop up window, the row selection should be made only by clicking on the row.....am trying to do it using the ajax modal popup control extender, i just sould't figure out a solution....

please help me, thank you in advance

Inplace Edit in GridView

In this article I am presenting a different way to look at EditItemTemplate, using which user navigation for editing is reduced and . it looks very different (see screeen shots) then regular implementation of GridView.

GridView Confirmation Box Using JQuery BlockUI in asp.net

JQuery is the most popular JavaScript library. One of the main reasons for its fame is the plugin architecture. Anyone can create a separate library that leverage the JQuery library. In this article we are going to look at the BlockUI library which is used to block the user screen while performing a task.

Using a CompareValidator to check input is a valid date

The CompareValidator can do more than just compare two controls. You can also compare it against several of the main .net data types such as Date, Integer, Double and Currency.

To do this you would set Operator="DataTypeCheck" and instead of setting the ControlToCompare or ValueToCompare attributes as you normally would you use the Type="Date" (or any of the data types I have listed above).

Textbox Editable GridView in ASP.NET

This article describes how I made a fully editable gridview in C# using ASP.NET 2. The idea is that the GridView looks and works like an Excel spreadsheet. You see all the cells in the table, and you can edit any of the cells you like, and they are automatically updated (i.e. saved to the database). This is very often how people expect data tables to work in web pages, and I've often seen people clicking in vain on un-editable gridview cells, somehow expecting to edit them, and not understanding that they need to click an Edit button at the end of the row.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend