Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Add Button column to Grid with Data

Reply
Thread Tools

Add Button column to Grid with Data

 
 
DBLWizard
Guest
Posts: n/a
 
      04-04-2005
I am poplating the grid with the following code:

myCommand = new SqlCommand(sSql, myConn);
myDA = new SqlDataAdapter();
myDA.SelectCommand = myCommand;
myConn.Open();
myDS = new DataSet();
myDA.Fill(myDS, "SearchResults");
grdMatching.DataSource = myDS.Tables["SearchResults"].DefaultView;
grdMatching.DataBind();
grdMatching.Visible = true;

The DataTable that is returned has 2 columns in it. I want to add a
another column either at the beginning or at the end that I can put a
button labeled "Select" that will fire a server side event that I can
act on knowing what row the user has clicked in.

What is the best was to do this?

Thanks

dbl

 
Reply With Quote
 
 
 
 
Alejandro Penate-Diaz
Guest
Posts: n/a
 
      04-04-2005
you can right click your datagrid, go to property builder, go to Columns,
deselect "Create columns automatically at run time", and then define your
columns. you can add one of the predefined button columns like Select, Edit,
Update or delete and the use it for your own prposes or define a new one.

"DBLWizard" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
>I am poplating the grid with the following code:
>
> myCommand = new SqlCommand(sSql, myConn);
> myDA = new SqlDataAdapter();
> myDA.SelectCommand = myCommand;
> myConn.Open();
> myDS = new DataSet();
> myDA.Fill(myDS, "SearchResults");
> grdMatching.DataSource = myDS.Tables["SearchResults"].DefaultView;
> grdMatching.DataBind();
> grdMatching.Visible = true;
>
> The DataTable that is returned has 2 columns in it. I want to add a
> another column either at the beginning or at the end that I can put a
> button labeled "Select" that will fire a server side event that I can
> act on knowing what row the user has clicked in.
>
> What is the best was to do this?
>
> Thanks
>
> dbl
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
add a column to data grid on fly d shah via .NET 247 ASP .Net 0 03-15-2005 10:03 PM
Add a radio button column in a grid view Fernando Lopes ASP .Net 3 12-07-2004 01:20 PM
Activa or not activate a button column depending if another data column has data or not carlos perez ASP .Net 0 06-08-2004 02:16 PM
How do you alternate images in a data bound column of a data grid control? C Newby ASP .Net 7 04-02-2004 05:00 PM
WebForm Data Grid Button column customization PatLaf ASP .Net Web Controls 1 01-28-2004 03:58 AM



Advertisments