Re: How to fire an event



Hi Daniela,

.... and in the mean time, you can possibly solve your problem by placing the
code from the event handler that isn't being called (which you could call
directly anyway) into another method as such:

void gd_UpdateRowBatch(object sender, EventArgs e)
{
CommonMethod();
}

void btn_Click(object sender, EventArgs e)
{
CommonMethod();
}

void CommonMethod()
{
// TODO: something in common
}

If the grid does things that require the event to actually be raised, you
might be able to emulate the effect yourself in the CommonMethod.

GL

--
Dave Sexton

"Daniela Roman" <danielaroman@xxxxxxxxxx> wrote in message
news:emku445AHHA.4568@xxxxxxxxxxxxxxxxxxxxxxx
Thanks. In fact I use a 3-rd party WEB grid control and for some reason it
does not fire the UpdateRowBatch event when I change the values of the grid
thru code. I need to raise that event thru other means.
The sample I provided is not the best example.

Is there another way of firing an event externally?


"Dave Sexton" <dave@jwa[remove.this]online.com> wrote in message
news:eHN$8z5AHHA.4992@xxxxxxxxxxxxxxxxxxxxxxx
Hi Daniela,

I want to fire the grid's event but I don't know how to call the event and
provide the parameter list for it:

There are many events on the DataGrid control. You just have to perform an
action that will cause the grid to raise the desired event. It's not
common to raise Control events externally; Controls raise their own events
internally.

Are you trying to get the PageIndexChanged event to be raised from your
button click event handler?

If so, change the CurrentPageIndex property and the event should be raised
by the DataGrid.

--
Dave Sexton

"Daniela Roman" <danielaroman@xxxxxxxxxx> wrote in message
news:OOLr774AHHA.4592@xxxxxxxxxxxxxxxxxxxxxxx
Hello,

I try to fire an event under a button click event and maybe anybody can
give a clue please.

I have let's say a WEB grid with PageIndexChanged event:

private void DataGrid1_PageIndexChanged(object source,
System.Web.UI.WebControls.DataGridPageChangedEventArgs e)

{

// Set CurrentPageIndex to the page the user clicked.

DataGrid1.CurrentPageIndex = e.NewPageIndex;


// Rebind the data.

DataGrid1.DataBind();

}



Under a button click event:

private void btnUpdtCmd_Click(object sender, System.EventArgs e)

{

}



I want to fire the grid's event but I don't know how to call the event and
provide the parameter list for it:

(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)



Thank you,

Daniela








.


Loading