473,508 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Causing events to fire in a datagrid

I finally learned that
DataGrid1.EditItemIndex = {row I want} -1
DataGrid1.DataBind()

will make that row get to edit mode.
I am stiil looking for ways to programticaly do other things:
1) show the last page
2) fire select
3) fire delete
4) what is the last row in the last page

Thanks!
Nov 19 '05 #1
2 1495
Hi Ofer,

1) Show the last page

DataGrid1.CurrentPageIndex = (DataGrid1.PageCount - 1)

2) fire select.

If I understand your question correctly....

With the method that you are using, when the "edit" button is "selected",
the grid will throw the EditCommand event. Try...

Create a sub and use the Handles statement to handle the EditCommand

Private Sub DataGrid1_EditCommand(blah blah....) Handles
DataGrid1.EditCommand

....

3) Fire delete

Same as 2 except you are handling the DeleteCommand event.

4) Last row in the last page

You could place the following in an if statement...

DataGrid1.Items.Count Mod DataGrid1.PageSize = 1 And _
DataGrid1.CurrentPageIndex = DataGrid1.PageCount - 1 And_
DataGrid1.CurrentPageIndex <> 0

Good Luck!
"Ofer" <Of**@discussions.microsoft.com> wrote in message
news:78**********************************@microsof t.com...
I finally learned that
DataGrid1.EditItemIndex = {row I want} -1
DataGrid1.DataBind()

will make that row get to edit mode.
I am stiil looking for ways to programticaly do other things:
1) show the last page
2) fire select
3) fire delete
4) what is the last row in the last page

Thanks!

Nov 19 '05 #2
Thanks!
To create the event handlers is NOT the problem VS does it for me when I
select the event from the dropdaown of events.

Also when you use the buttons created by the property builder, a click on
the button does more then just fire the event. for example the the
editcommand draws text boxes for the bound columns and only then fire the
event.

what I am looking for, is the syntax to make those commands work.
for example I have a button to add a row that first inserts a new (almost
empty) row in the database then I want it to show that row and put it in edit
mode.
So all in all I want to be able to imitate the user's clicks on the command
buttons.
"James Steele" wrote:
Hi Ofer,

1) Show the last page

DataGrid1.CurrentPageIndex = (DataGrid1.PageCount - 1)

2) fire select.

If I understand your question correctly....

With the method that you are using, when the "edit" button is "selected",
the grid will throw the EditCommand event. Try...

Create a sub and use the Handles statement to handle the EditCommand

Private Sub DataGrid1_EditCommand(blah blah....) Handles
DataGrid1.EditCommand

....

3) Fire delete

Same as 2 except you are handling the DeleteCommand event.

4) Last row in the last page

You could place the following in an if statement...

DataGrid1.Items.Count Mod DataGrid1.PageSize = 1 And _
DataGrid1.CurrentPageIndex = DataGrid1.PageCount - 1 And_
DataGrid1.CurrentPageIndex <> 0

Good Luck!
"Ofer" <Of**@discussions.microsoft.com> wrote in message
news:78**********************************@microsof t.com...
I finally learned that
DataGrid1.EditItemIndex = {row I want} -1
DataGrid1.DataBind()

will make that row get to edit mode.
I am stiil looking for ways to programticaly do other things:
1) show the last page
2) fire select
3) fire delete
4) what is the last row in the last page

Thanks!


Nov 19 '05 #3

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

Similar topics

0
1481
by: Dinesh Upare | last post by:
Hi, I want to fire events of Datatgrid without maintaining the view state. If I disable the ViewState then the events are not fired. The reason I don't want to maintain view state is because its...
6
4469
by: Mark | last post by:
I have been working for quite some time on this issue which in theory should be quite simple. The problem is that the Cancel and Save events are not fired when their respective buttons are...
0
1387
by: Daniel Armstrong | last post by:
Hello, I have a usercontrol that I have built that has a single generic datagrid. When setting up the inital properties I build the template columns for the datagrid dynamically so it can...
7
2257
by: Lars Netzel | last post by:
If I put a checkbox in a datagrid (ASP.NET) and set the Autopostback to true I can catch OnChange event on checkbox but how do I then catch what DataGridItemIndex is? Can I use some Event in the...
4
1317
by: JJ | last post by:
Hi, I was wondering is it possible to create my own html table that has two features. 1. it is databound and 2. create my own events for it? The datagrid is nice and I do use it but I need to...
1
2093
by: Peter Rilling | last post by:
I have an interesting problem with a datagrid. It is the standard chicken-and-the-egg problem. I have this page with two datagrids. It essentially defines a parent-child relationship. The...
0
1119
by: ariesc | last post by:
I upgraded from .NET 2002 to .NET 2003 and found one weird things on the LEAVE / ENTER events within a datagrid. I added handler to each textbox of a datagrid, then handle the ENTER/LEAVE events....
1
2033
by: margant | last post by:
Dear Professionals, I have placed my datagrid : .... <asp:Datagrid ID="DGEdu" runat="server" OnDeleteCommand="DGEdu_Remove" OnItemDataBound="DGEdu_ItemDataBound"...
6
1725
by: Steve Hershoff | last post by:
Hi everyone, I've got a strange one here. There are two datagrids on my page, one nested within the other. I'll refer to them as the topmost and secondary datagrids. In the topmost...
0
7231
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
7132
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...
0
7336
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,...
0
7401
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...
1
7063
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...
0
3196
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1568
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 ...
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
432
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...

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.