DataGrid - Reading values when Items.Count=1

F

Fred Nelson

Hi:

I have a VB.NET web app and in one section I'm creating a datagrid that
lists several id's and names - I would like to be able to send the user to
another web page if only one record matches the search criteria:

The class lib returns two fields "custid" and "custname" - I need to obtain
the custid to go to the next web page.

=======

dim lookup function as new getcusts.search

DataGrid1.DataSource = lookup.searchnames(getinformation)
DataGrid1.DataBind

if DataGrid1.Items.Count = 1

// get the value and use it to go to another web page.

response.redirect("nextpage.aspx?custid=" + custidvalue.tostring)

end if

Any help would be greatly appreiciated - I haven't found a way for this to
work!

Thanks,

Fred
 
F

Fred Nelson

Brian:

The commands that you gave me don't work with a datagrid - I have access
only to the grid and not a data table.

If there is a way to read the values from a datagrid (with no user
intervention) I would like to know about it.

Thanks,

Fred
 
C

Cor Ligthert

Fred,


Did you create a button column in your datagrid, than it should be easy to
get that value when the user clicks that and does the redirect as you told
with that value.

Cor
 
F

Fred Nelson

Cor:

Thanks for your answer.

I want to be able to read the datagrid directly - then if there is only one
record in it - exract the information (in this case customer id) and
redirect them to an update page without them having to click.

if datagrid1.items.count = 1

dim mycustid as string
mycustid = datagrid1.row(0).col(0).Itemvalue


Is there a way to read the values in a datagrid after is has been binded?

Thanks,

Fred
 

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

Top