How to pre-select a control of a DataGrid ?

S

savvy

savvy
Feb 1, 4:23 pm show options

Newsgroups: microsoft.public.dotnet.framework.aspnet
From: "savvy" <[email protected]> - Find messages by this author
Date: 1 Feb 2006 08:23:19 -0800
Local: Wed, Feb 1 2006 4:23 pm
Subject: How to Pre-Select a DataGrid Row Radiobutton ?
Reply | Reply to Author | Forward | Print | Individual Message | Show
original | Remove | Report Abuse

I have used MetaBuilders.WebControls for including a radiobutton in a
datagrid. Its works fine with retreiving the checked radiobutton
datagrid row id. but i'm not able to preselect the row radiobutton
which matches with the database data. ok
I have a Datagrid which displays CV details created by a candidate. So
i want him to make only one of his CVs as a default one. Therefore i
included a radiobutton column which selects the particular row of the
datagrid and stores in it in the database with a Flag 1 or 0.
So, everytime i will be comparing the flag and if its 1 then i want the

radio button of that particular row to be checked. I tried alot but i'm

getting nowhere
Any help will be greatly appreciated
Thanks in Advance


I'm using this code
using MetaBuilders.WebControls;


objcmd = new SqlCommand("SelectCVdetails",
objConn);
objcmd.CommandType =
CommandType.StoredProcedure;
objcmd.Parameters.Add("@js_id",
Session["JSRegID"]);
objConn.Open();
objRdr = objcmd.ExecuteReader();
dgcvdetails.DataSource=objRdr;
dgcvdetails.DataBind();
objRdr.Close();
objConn.Close();
for (int i = 0; (i <= (dgcvdetails.Items.Count
- 1)); i++)
{
if ((dgcvdetails.Items.Cells[6].ID
== intcv_id.ToString()))
{
dgcvdetails.Items.BackColor
= System.Drawing.Color.Blue;
HtmlInputRadioButton rsc =
((HtmlInputRadioButton)(dgcvdetails.Items.FindControl("RowSelectorColumn­Selector")));

rsc.Checked = true;
break;
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,072
Latest member
trafficcone

Latest Threads

Top