ASP.NET - get radio button selection in grid view.
Asked By raj
29-Apr-10 05:00 AM
Hi,
i have a grid view having 8 columns, where i am adding the radio button at runtime in RowDataBound event of gridview in 4 columns. the radio button will be visible on some conditions and there can be one radion button as selected in one row. when user click any radio button, i need to check some value in DB side. i have added
radiobutton.CheckedChanged +=
new EventHandler(radiobutton_CheckedChanged);
but the problem is whenever i click any radio button, i got the focus for all selected radio button. means if 5 radio button is selected in 5 rows, then the radiobutton's checkedchanged event is called 5 times for every selected radio button.
how can i get only the current selected radio button value, not all???
pls help.
Kashish Malhotra replied to raj
I also faced the same problem but couldn't find a proper solution. However i could achieve the desired result with the following workaround.
1. Added a javascript function in the radiobutton click like following (along with checkededChanged also add this)
rdoInhouse.Attributes.Add("onClick", string.Concat("SelectOne(this,'grdUser',", currentRow, ")"));
2. In the SelectOne javascript function fetch the selected radiobutton id and assign it to a hidden field.
3. In the radiobutton CheckedChanged event get the radio button id from sender object and compare it with
the value stored in hidden field, if it matches then execute the db call.
Hope this helps. If anyone has a better solution please reply becuase i am also looking for it :)
vikram malhotra replied to Kashish Malhotra
brother u use e.command property
bt id and then call the function u get solution
on row data bound
and on any event
pass the value of the id........

is used In ADO you communicate with the database by making calls to an OLE DB provider. In ADO.NET you communicate with the database through a data adapter (an OleDbDataAdapter, SqlDataAdapter, OdbcDataAdapter, or OracleDataAdapter object), which makes calls to an OLE DB provider or the APIs provided by the underlying data source. In ADO you cant update in Sql server as var_name int How do you separate business logic while creating an ASP.NET application? There are two level of asp.net debugging 1. Page level debugging For this we have to edit the page level debugging Control in a Windows Application It’s just like adding any other control like a button or a label. 1) First, create a new Windows Application project named: CustomControl. 2) Add The control itself will take care of the date display How can you deploy an asp.net application ? You can deploy an ASP.NET Web application using any one of the
Net hi friends Any one send frequently asked Important questions in C# .Net, ADO .Net, Asp .Net and Sql Server. . . . . . . . tx in Advance. . . . . . Hi, Find this. . (B)What is an IL? (B A) What is scavenging? (B) What are different types of caching using cache object of ASP.NET? (B) How can you cache different version of same page using ASP.NET cache object? (A) How will implement Page Fragment Caching? (B) Can you compare ASP.NET sessions with classic ASP? (B) Which are the various modes of storing ASP.NET session
Migration from ASP to ASP.net How to convert ASP site to ASP.NET site using C# http: / / www.asp.net / downloads / archived-v11 / migration-assistants / asp-to-aspnet hi, ASP.NET framework is very much different from unstrucured ASP and there is no correct way to
Tracing in ASP.NET? hi all, what is tracing? how to achieve tracing in asp.net? different ways of doing tracing? thanks and regards Aman Khan hi. . Tracing in ASP.NET 2.0 Tracing is a way to monitor the execution of your ASP.NET application. You can record exception details and program flow in a way that doesn't
session is user based mean u can differentiate login user in different way • Process independent. ASP.NET session state is able to run in a separate process from the ASP.NET host process. If session state is in a separate process, the ASP.NET process can come and go while the session state process remains available. Of course, you ASP, too. • Support for server farm configurations. By moving to an out-of-process model, ASP.NET also solves the server farm problem. The new out-of-process model allows all servers