Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Causing events to fire in a datagrid

Reply
Thread Tools

Causing events to fire in a datagrid

 
 
=?Utf-8?B?T2Zlcg==?=
Guest
Posts: n/a
 
      04-04-2005
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!
 
Reply With Quote
 
 
 
 
James Steele
Guest
Posts: n/a
 
      04-05-2005
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" <> wrote in message
news:783FDFAF-1D72-4526-A859-...
>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!



 
Reply With Quote
 
 
 
 
=?Utf-8?B?T2Zlcg==?=
Guest
Posts: n/a
 
      04-05-2005
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" <> wrote in message
> news:783FDFAF-1D72-4526-A859-...
> >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!

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Events Events Events Please Help Chris ASP .Net Web Controls 0 08-30-2005 08:21 PM
DataGrid edit events fire twice David Rose ASP .Net 1 01-13-2004 03:37 AM
Dynamic Datagrid does not fire events. Mark ASP .Net 6 08-03-2003 06:35 PM
Datagrid events refuse to fire Simon Storr ASP .Net Datagrid Control 0 07-15-2003 11:49 AM
how to fire events of dropdownlist in datagrid Balaji ASP .Net 1 06-26-2003 12:57 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57