473,847 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGrid - Reading values when Items.Count=1

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.DataS ource = lookup.searchna mes(getinformat ion)
DataGrid1.DataB ind

if DataGrid1.Items .Count = 1

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

response.redire ct("nextpage.as px?custid=" + custidvalue.tos tring)

end if

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

Thanks,

Fred
Nov 20 '05 #1
3 5447
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*****@discus sions.microsoft .com> wrote in message
news:59******** *************** ***********@mic rosoft.com...
Value = DatasetName.Tab le(0).row(?).it em(?)

"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.DataS ource = lookup.searchna mes(getinformat ion)
DataGrid1.DataB ind

if DataGrid1.Items .Count = 1

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

response.redire ct("nextpage.as px?custid=" + custidvalue.tos tring)

end if

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

Thanks,

Fred

Nov 20 '05 #2
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
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).Itemva lue
Is there a way to read the values in a datagrid after is has been binded?

Thanks,

Fred
"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:eq******** *****@TK2MSFTNG P12.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4345
by: pei_world | last post by:
I want to implement a key hit with enter to dropdown a combobox that is in the datagrid. in this case I need to override its original behaviours. I found some codes from the web. Does anyone know how to use this code? please help! http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_20862953.html
2
3317
by: Alpha | last post by:
I have a window application. In one of the form, a datagrid has a dataview as its datasource. Initial filtering result would give the datavew 3 items. When I double click on the datagrid to edit the selected lie item at which case I would pop up a separate dialog box to do so, in the debugging code, the dataview.count would return 0. I get a error message because I tried to get values out of a dataview that holds 0 items. Does anyone...
4
1523
by: Jim Heavey | last post by:
Hello, I am starting to learn how to use the Datagrid and I have a couple of questions. My datagrid as a checkbox in it. It looks like the following in the datagrid... <asp:TemplateColumn HeaderText="Check In"> <ItemStyle HorizontalAlign="Center" Width="30px"></ItemStyle> <ItemTemplate> <asp:CheckBox id="chkReturn" runat="server" OnCheckedChanged="CheckItIn"></asp:CheckBox>
0
1542
by: Ozer | last post by:
Hi guys, I need some help. In my datagrid's updatecommand event i'm trying to get textboxes values and also do it. But when i update the values in textboxes and fire the event, I can't get the updated values. Please help me. Thanks for any help. Bye. Ozer And here's my code: Imports System Imports System.Data Imports System.Data.OleDb
9
5070
by: tshad | last post by:
How do I find (and set) a couple of labels in the Footer after a DataGrid is filled? I have a bunch of DataGrids that get displayed nested inside a DataList. The datagrid looks like: ******************************************************************************* <asp:DataGrid visible="False" border=1
1
6127
by: Merdaad | last post by:
I have a datagrid that reads several rows of data from the database and loads them on the screen. Now I want to dynamically add a new row and assign the cells in the new row, values. When I try to create a datagridItem, I use the following call: int newIndex = datagrid1.Items.Count; // returns 15 the current number of rows in the grid datagrid1.Items.DataItem = new DataGridItem(newIndex, ?, ListItemType.Item);
5
2659
by: Gary Blakely | last post by:
I'm giving this post another try - it can't be too difficult for everyone.... In the program below, the web page has dataGrid1. the only thing that has been done to it at design time is to check the "Create columns automatically at runtime" checkbox - nothing else. The code below does indeed create the visual grid as expected. Furthermore the Cell contents and Item count all exist and contain expected values. However there is no...
5
1391
by: Coleen | last post by:
Hi all :-) We are using a DB2 database connection through a class module to get the data into a datagrid in an aspx web page using VB.Net. I can get the data into the first datagrid with no problem, however, since I need to do a bunch of calculations with these values AND pull values for two session variable within the web application, I need to create another datagrid to display the calculations. Here is what I'm doing: ...
5
2989
by: BMeyer | last post by:
I have been losing my mind trying to parse an XML document (with nested child elements, not all of which appear in each parent node) into a DataGrid object. What I want to do is "flatten" the XML document into a text document with a single row for each parent node (that has all of the values from all of the child nodes for that row) The DataView within VS 2005 IDE displays my 15 or so child tables - and knows that some parent rows...
0
9727
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10705
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9477
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7879
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5716
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5907
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4113
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3158
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.