DataGrid - Reading values when Items.Count=1

  • Thread starter Thread starter Fred Nelson
  • Start date Start date
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
 
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
 
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
 
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
 
Back
Top