wondering what the difference is

G

Guest

hey all,

i saw the following in an article:

<asp:DataGrid id="grdOrder" Runat="server"

OnPageIndexChanged="grdOrder_OnPageIndexChanged"
OnItemCommand="grdOrder_OnItemCommand"
OnEditCommand="grdOrder_OnEditCommand"
OnUpdateCommand="grdOrder_OnUpdateCommand"
OnCancelCommand="grdOrder_OnCancelCommand"
What I want to know is, normally what i'm accustomed to is in the
code-behind you can select the datagrid from the left-drop down list and then
in the right drop-down list you can select the event and it will
automatically stub the event procedure for you.

It seems to me there are two different ways to do it. Is there a difference
in doing it one way or another. Can someone please enlighten me on this.

thanks,
rodchar
 
G

Grant Merwitz

Yes, you can either specify this through the code behind or in the ASPX
page.

The major difference being the method your calling will have to be public if
its called from the ASPX page and can be private if called from the code
behind.

I prefer using the Code Behind as it all goes into the InitialiseComponent
method and i find it easier to control from there.
Then again, in the ASPX side, you don't have to recompile if you change this
(unless the method name your calling is changing)

But functionally, they both do the same thing

(don't think there's anything else i'm overlooking, but there may well be,
anyone?)
 
E

Eliyahu Goldin

There is a famous problem with VS. Sometimes it erases the events set in the
Design mode. Defining events in .aspx file saves you from this. Also you can
trace changes with version control easier.

Eliyahu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top