By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,326 Members | 838 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,326 IT Pros & Developers. It's quick & easy.

DataGrid - Reading values when Items.Count=1

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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
"BrianDH" <Br*****@discussions.microsoft.com> wrote in message
news:59**********************************@microsof t.com...
Value = DatasetName.Table(0).row(?).item(?)

"Fred Nelson" wrote:
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

Nov 20 '05 #2

P: n/a
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
Nov 20 '05 #3

P: n/a
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
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:eq*************@TK2MSFTNGP12.phx.gbl...
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

Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.