Using:
DataGrid1_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
DataGrid1.ItemCommand
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).FindControl("txtQuestion"), 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("txtQuestion") 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. 4 2285
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.Cells(8).FindControl("dr_lst_orig"), DropDownList)
dr_ctrl.Items.Insert(0, "Select ..")
dr_ctrl.SelectedIndex = 0
"Chris" wrote: Using: DataGrid1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles DataGrid1.ItemCommand
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).FindControl("txtQuestion"), 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("txtQuestion") 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.
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 CommandEventArgs.
"e.Item(1).FindControl("txtQuestion"), 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.Cells(8).FindControl("dr_lst_orig"), DropDownList) dr_ctrl.Items.Insert(0, "Select ..") dr_ctrl.SelectedIndex = 0
"Chris" wrote:
Using: DataGrid1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles DataGrid1.ItemCommand
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).FindControl("txtQuestion"), 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("txtQuestion") 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. If there are say 5 rows in the datagrid and I want control("txtQuestion")
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).FindControl("txtCompany") ,
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
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("txtQuestion") 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).FindControl("txtCompany") , 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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,...
|
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...
|
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...
|
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...
|
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,
...
|
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...
|
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 =...
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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,...
| |