473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to determing Grid object

I have multiple Grid objects that are editable on my page. The following is
an example of the onEditCommand method. In this case D1 (the Grid object)
is known.

************************************************** **
sub DataEdit(S as Object, E as DataGridCommandEventArgs)
trace.warn("in DataEdit")
D1.EditItemIndex=Cint(E.Item.ItemIndex)
FillUpGrid()
end sub
************************************************** ***

In my case, I have a Datalist that has multiple DataGrids in them, something
like:

************************************************** **********
<asp:datalist id="DataList1"
runat="server"
Width="100%"
BorderWidth="0px"
OnItemCommand="OnSelectIndexChanged"
footerstyle-horizontalalign="center"
CellPadding="0"
CellSpacing="0"
style="margin:0">
<AlternatingItemStyle cssClass=alternateRow
</AlternatingItemStyle>

<asp:DataGrid visible="False"
id="DataGrid1"
runat="server"
Width="400px"
Height="79px"
AutoGenerateColumns="False"
GridLines="None"
onEditCommand="DataEdit"
onCancelCommand="DataCancel"
onUpdateCommand="DataUpdate">
</asp:datalist>
************************************************** ****************************************

Here there are multiple datagrids (one for each listitem). When I run my
onEditCommand routine, it needs to know the DataGrid to bind the data to.

It can't be DataGrid1.

How do I determine the Grid object from:

sub DataEdit(S as Object, E as DataGridCommandEventArgs)

Thanks,

Tom.
Nov 18 '05 #1
2 1052
Tom, typically you'd have a separate event handler for each of the
DataGrids' OnEditCommand events. However, you have some (or all) of the
DataGrid's trigger the same event handler. The first input parameter of
the event handler contains the control that raised the event.

sub DataEdit(S as Object, E as DataGridCommandEventArgs)
trace.warn("in DataEdit")

Dim dg as DataGrid = CType(S, DataGrid)
trace.warn("The DataGrid is " & dg.ID)

D1.EditItemIndex=Cint(E.Item.ItemIndex)
FillUpGrid()
end sub

hth
tshad wrote:
I have multiple Grid objects that are editable on my page. The following is
an example of the onEditCommand method. In this case D1 (the Grid object)
is known.

************************************************** **
sub DataEdit(S as Object, E as DataGridCommandEventArgs)
trace.warn("in DataEdit")
D1.EditItemIndex=Cint(E.Item.ItemIndex)
FillUpGrid()
end sub
************************************************** ***

In my case, I have a Datalist that has multiple DataGrids in them, something
like:

************************************************** **********
<asp:datalist id="DataList1"
runat="server"
Width="100%"
BorderWidth="0px"
OnItemCommand="OnSelectIndexChanged"
footerstyle-horizontalalign="center"
CellPadding="0"
CellSpacing="0"
style="margin:0">
<AlternatingItemStyle cssClass=alternateRow
></AlternatingItemStyle>

<asp:DataGrid visible="False"
id="DataGrid1"
runat="server"
Width="400px"
Height="79px"
AutoGenerateColumns="False"
GridLines="None"
onEditCommand="DataEdit"
onCancelCommand="DataCancel"
onUpdateCommand="DataUpdate">
</asp:datalist>
************************************************** ****************************************

Here there are multiple datagrids (one for each listitem). When I run my
onEditCommand routine, it needs to know the DataGrid to bind the data to.

It can't be DataGrid1.

How do I determine the Grid object from:

sub DataEdit(S as Object, E as DataGridCommandEventArgs)

Thanks,

Tom.

--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!
Nov 18 '05 #2
Scott,

That was what I was looking for.

I assume that I would then do something like:

Dim dg as DataGrid = CType(S, DataGrid)

dg.bind()

I really appreciate the help,

Thanks,

Tom.

"Scott Mitchell [MVP]" <mi******@4guysfromrolla.com> wrote in message
news:41**************@4guysfromrolla.com...
Tom, typically you'd have a separate event handler for each of the
DataGrids' OnEditCommand events. However, you have some (or all) of the
DataGrid's trigger the same event handler. The first input parameter of
the event handler contains the control that raised the event.

sub DataEdit(S as Object, E as DataGridCommandEventArgs)
trace.warn("in DataEdit")

Dim dg as DataGrid = CType(S, DataGrid)
trace.warn("The DataGrid is " & dg.ID)

D1.EditItemIndex=Cint(E.Item.ItemIndex)
FillUpGrid()
end sub

hth
tshad wrote:
I have multiple Grid objects that are editable on my page. The following
is an example of the onEditCommand method. In this case D1 (the Grid
object) is known.

************************************************** **
sub DataEdit(S as Object, E as DataGridCommandEventArgs)
trace.warn("in DataEdit")
D1.EditItemIndex=Cint(E.Item.ItemIndex)
FillUpGrid()
end sub
************************************************** ***

In my case, I have a Datalist that has multiple DataGrids in them,
something like:

************************************************** **********
<asp:datalist id="DataList1"
runat="server"
Width="100%"
BorderWidth="0px"
OnItemCommand="OnSelectIndexChanged"
footerstyle-horizontalalign="center"
CellPadding="0"
CellSpacing="0"
style="margin:0">
<AlternatingItemStyle cssClass=alternateRow
></AlternatingItemStyle>

<asp:DataGrid visible="False"
id="DataGrid1"
runat="server"
Width="400px"
Height="79px"
AutoGenerateColumns="False"
GridLines="None"
onEditCommand="DataEdit"
onCancelCommand="DataCancel"
onUpdateCommand="DataUpdate">
</asp:datalist>
************************************************** ****************************************

Here there are multiple datagrids (one for each listitem). When I run my
onEditCommand routine, it needs to know the DataGrid to bind the data to.

It can't be DataGrid1.

How do I determine the Grid object from:

sub DataEdit(S as Object, E as DataGridCommandEventArgs)

Thanks,

Tom.

--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!

Nov 18 '05 #3

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

Similar topics

5
by: pmud | last post by:
Hi, I need to display columns in a data grid based on 7 different queries. Now I have 32 questions: 1. Is it possble to have 1 single data adapter with 7 queries & 1 data set or do I need to...
1
by: Ubi | last post by:
Hello, i have a table. a dataView and a DataGrid. I'm using the dataView to filter the table. When the user double clicks on the DataGrid i want to get the data of the first col from the row...
1
by: Steve | last post by:
Hi I have a db with 2 tables that I want to bind to a grid depending on a selection in a Dropdownlist Also I want to be able to select a row from the gris to fill some textboxes. The databases...
4
by: blackhawk | last post by:
I need to build a web page that has to potentially display a large amount of data in two grids on the same page. The HTML file with all of the formatting is about 7MB in size. This is too large...
4
by: Girish | last post by:
Im trying to create a grid within a grid programmatically. Ive been successful in doing this but I need the embedded grid to fire its ItemDataBound event so I can handle it. The event does not seem...
2
by: SStory | last post by:
I have a picture that I allow the user to move around and would like to offer grid support like VB and other apps so that it will snap to the nearest point. How can I offer grid support so that...
0
by: Stu | last post by:
Hi, Im using VB dot net and crystal 11 I have a mainReport with a parameter @Idcustomer and in the mainReport I have a subreport @customerId They are linked using crystal. I would like to...
5
by: =?Utf-8?B?RGF2aWQgTGV2aW5l?= | last post by:
This is really more of a "why was C# designed this way?" type of question. Hope this is the write forum for this question. Given the following : class Base1 { public int i; } struct Base2...
1
by: asharda | last post by:
I have a custom property grid. I am using custom property grid as I do not want the error messages that the propertygrid shows when abphabets are entered in interger fields. The custom property...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
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...
0
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...
0
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,...
0
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...

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.