473,657 Members | 2,538 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

help finding an item in a datagrid

Using:
DataGrid1_ItemC ommand(ByVal source As Object, ByVal e As
System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles
DataGrid1.ItemC ommand

is there a way to find a specific item in the datagrid. I'm using the
CommandEvent to do some stuff. When I try to use syntax like this:

e.Item(1).FindC ontrol("txtQues tion"), TextBox).Text

or other variations is says that e.item can not be used to find a particular
row, etc.

If there are say 5 rows in the datagrid and I want control("txtQue stion") on
row 2, how do I get that?

Once I click the commandevent I have the row, and fields, I'm on. But I also
need other rows values????

Make sense?

Thanx.

Nov 19 '05 #1
4 2292
Hi Hope this helps,
I am using the following code to set some parameters in a dropdown box that
is a control in a data grid. This seems to work ok.
Dim dr_ctrl As DropDownList
dr_ctrl = CType(e.Item.Ce lls(8).FindCont rol("dr_lst_ori g"), DropDownList)
dr_ctrl.Items.I nsert(0, "Select ..")
dr_ctrl.Selecte dIndex = 0

"Chris" wrote:
Using:
DataGrid1_ItemC ommand(ByVal source As Object, ByVal e As
System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles
DataGrid1.ItemC ommand

is there a way to find a specific item in the datagrid. I'm using the
CommandEvent to do some stuff. When I try to use syntax like this:

e.Item(1).FindC ontrol("txtQues tion"), TextBox).Text

or other variations is says that e.item can not be used to find a particular
row, etc.

If there are say 5 rows in the datagrid and I want control("txtQue stion") on
row 2, how do I get that?

Once I click the commandevent I have the row, and fields, I'm on. But I also
need other rows values????

Make sense?

Thanx.

Nov 19 '05 #2
I'm not sure how this fits into my need.
You use cells(value) to locate the control, I can't. It's not available
apparently in CommandEventArg s.

"e.Item(1).Find Control("txtQue stion"), TextBox).Text

or other variations is says that e.item can not be used to find a particular
row, etc."

I'm on the code-behind.

Thanx.

"Paul" wrote:
Hi Hope this helps,
I am using the following code to set some parameters in a dropdown box that
is a control in a data grid. This seems to work ok.
Dim dr_ctrl As DropDownList
dr_ctrl = CType(e.Item.Ce lls(8).FindCont rol("dr_lst_ori g"), DropDownList)
dr_ctrl.Items.I nsert(0, "Select ..")
dr_ctrl.Selecte dIndex = 0

"Chris" wrote:
Using:
DataGrid1_ItemC ommand(ByVal source As Object, ByVal e As
System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles
DataGrid1.ItemC ommand

is there a way to find a specific item in the datagrid. I'm using the
CommandEvent to do some stuff. When I try to use syntax like this:

e.Item(1).FindC ontrol("txtQues tion"), TextBox).Text

or other variations is says that e.item can not be used to find a particular
row, etc.

If there are say 5 rows in the datagrid and I want control("txtQue stion") on
row 2, how do I get that?

Once I click the commandevent I have the row, and fields, I'm on. But I also
need other rows values????

Make sense?

Thanx.

Nov 19 '05 #3
If there are say 5 rows in the datagrid and I want control("txtQue stion") on row 2, how do I get that?


Hmm.... i may be missing out on something, but how would this work for you?
Label1.Text = CType(DataGrid1 .Items(2).FindC ontrol("txtComp any"),
TextBox).Text

Now.... this requires that the txtCompany textbox is in a template column,
and ofcourse that the textbox is named "txtCompany ".

Hope it helps.
Jeppe Jespersen
Nov 19 '05 #4
Thanx! don't know how I missed that.

"Jeppe Dige Jespersen" wrote:
If there are say 5 rows in the datagrid and I want control("txtQue stion")

on
row 2, how do I get that?


Hmm.... i may be missing out on something, but how would this work for you?
Label1.Text = CType(DataGrid1 .Items(2).FindC ontrol("txtComp any"),
TextBox).Text

Now.... this requires that the txtCompany textbox is in a template column,
and ofcourse that the textbox is named "txtCompany ".

Hope it helps.
Jeppe Jespersen

Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6814
by: Sean | last post by:
Hi, I am facing a problem, and i don't know why the error is being generated. I am updating a datagrid with an XML file. My code is Protected Sub UpdateCommand(ByVal Sender As Object, ByVal E As DataGridCommandEventArgs) Try
1
1251
by: MrNobody | last post by:
what I'd like to have is a simple feature to search within a column in a DataGrid and have that the first matching row selected, then the user can choose to search again where it will select the next matching row. I would love a syntax where it can accept wildcards, i.e. search item name for '%red%' to search for anything that has the word 'red' anywhere within it. So far my only solution was to create a new DataView for each search...
1
2965
by: Mike | last post by:
I have an ASP.NET/VB app that updates values in a DataTable over the course of about 3 different pages. On the way out of the first of these pages, I explicitly build the DataTable from values in a DataGrid, and set the PrimaryKey of the DataTable to be the first cell in the grid (which is a UserID value). I then store the DataTable in a session object, from which it is retrieved for subsequent pages. All this seems to be working fine. ...
5
5960
by: GaryB | last post by:
The datagrid.items collection only appears to have data rows in it. for Instance... dim myItem ad dataGridItem myItem = myGrid.Items(0) returns the first data row of data. How can I access the Headertext and footer text? The docs say ... " A DataGridItem represents an item (row) in a DataGrid control, such as a
10
1712
by: Joe | last post by:
Hi, Tried using the FindControl() but no luck in finidng this damn textbox having id txtFirstName. Can someone help me with this method? This is what I have been doing but it doesn't work, Dim txtFName As TextBox txtFName = CType(myDataGrid.FindControl("txtFirstName"), TextBox)
10
1899
by: Terry Olsen | last post by:
I've got a datagrid set up to display data. I've also got an Edit,Update,Cancel column set up to allow editing of data. I've got a DropDownList (ID="ddl3")in the EditItemTemplate for a certain column that I need to populate while in Edit Mode. Two questions: Is there a way to directly use another DropDownList as a DataSource? If so how? I'm using the following code to try to populate the DropDownList, but
2
1278
by: hansiman | last post by:
When I want to add a js confirm box to a delete button that is positioned in the last column in a datagrid row I do the following in the ItemDataBound event: Dim delBtn As LinkButton = e.Item.Cells(10).Controls(0) delBtn.Attributes("onclick") = "javascript:return confirm('you sure?');" If I want to change an image in a datagrid row I do the following in the ItemDataBound event:
7
2189
by: Aaron | last post by:
Complete code follows. I am new to .NET programming (and programming in general) and I am having a difficult time understanding how to fill a variable in one sub, and then access it from another. I have tried declaring them as shared, public, friend, etc and I always get an error stating that something is not valid on a local variable declaration. For example, in the following code for Sub DataGrid_Select, I have CurrentID and...
3
2515
by: Datatable Dataset Datagrid help | last post by:
Hi I am somewhat confused, I am new at VB.net I use XML data, I have a datagrid, I created a datatable so that I can create a custom format like true is this graphic false is this graphic and others. One of the custom format is as follows: dsmessages_dt.Columns.Add("Image", GetType(Image)) I had a problem of when I used a checkbox in the grid that was bound to the datatable that it would not update my dataset. So I created another...
0
8413
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8617
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
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...
1
2742
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
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
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.