Check only one radio button gridview item template
->>>> Click Here to Download <<<<<<<-
Search related threads. Remove From My Forums. Answered by:. Archived Forums. Getting Started with ASP. NET question on a topic that's not covered by one of the other more specific forums - ask it here. Sign in to vote. User posted Hi, I am using below code to check only one radio button which is in gridview item template.
Thursday, August 13, AM. User posted Quoting code from another post to give you a gist. User posted Try using a RadioButtonList instead. User posted hi.. Eval Container. HtmlInputRadioButton Item. FindControl "RBList". Asked 8 years, 10 months ago. Active 8 years, 10 months ago. Viewed 2k times. I have the following grid view.
Mihir Mihir 8, 17 17 gold badges 53 53 silver badges 83 83 bronze badges. Why -1? If you give the comment before negative voting i can improve myself. Thanks — Mihir.
Does your radio buttons need to perform actions on server? Can they be normal html radio buttons? At this point i didn't implementing the server functionality. As of now i am trying for selecting the row by checking the radio button.
After checking it i want to retrieve the values of cells not yet implemented. We cannot insert html code into the grid view itemtemplate — Mihir.
Show 1 more comment. Active Oldest Votes. ConnectionStrings "conString". Fill dt. Catch ex As Exception. Throw ex. End Try. End Sub. Net GridView control. I am calling the above function in the Page Load event of the page like below. GetSelectedRecord ;. BindGrid ;. Note here I am calling one more function GetSelectedRecord which will be described later.
Maintaining state of the RadioButtons. I am using ViewState variable to store the ID of the selected record. This helps me to remember the state of the RadioButtons. To achieve this I am using the following two functions. FindControl "RadioButton1" ;. FindControl "HiddenField1" ;. Private Sub GetSelectedRecord. Count - 1. Rows i. If rb IsNot Nothing Then. If rb.
Checked Then. If hf IsNot Nothing Then. End If. Exit For. This method is called in the page load event of the page. Equals ViewState[ "SelectedContact" ]. Private Sub SetSelectedRecord. Cells 0. If hf.
Equals ViewState "SelectedContact". ToString Then. The above function simply loops through the records in the current page of the ASP.