DataGrid in c#

G

Guest

I got a DataGrid on my webpage and I populate it by a query on the database
and after I make a DataBind method.

The Porblem is that I want some field to be clickable and of course I would
like it to send me an ID that I take from the Database.

That's my code:

-In .aspx page:
<asp:DataGrid id="dglista" runat="server"></asp:DataGrid>

-in .aspx.cs page (the codebehind page):

DataGrid dglista;
// after the query...
dglista.DatSource = ..dataset.Tables["tblista"];
dglista.DataBind();

How can I have a field where I can Click?

The page is a list where I should be able to select an item(row).

Thanks
 
E

Elton Wang

Hi AntoS,

You can think about using ButtonColumn
(ButtonType=LinkButton, DataTextField = DataField).

HTH

Elton Wang
(e-mail address removed)
 
J

JiangZemin

Hi,
the ASPNET quickstart tutorials at www.asp.net have great simple examples
how to do this. look under "web controls syntax reference", section
"datagrid".

HTH,
Premier JiangZemin, MCSD.NET
 

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

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top