Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > EditCommandColumn not genereting correct events

Reply
Thread Tools

EditCommandColumn not genereting correct events

 
 
Jaime
Guest
Posts: n/a
 
      05-14-2005
Hi all,

I have a datagrid with 2 databound columns and one EditCommandColumn, now
when I press the edit link, the correct OnEditCommand event is generated and
my user defined function is called (I'm sepcifying the name of the function
in the datagrid OnEditCommand="OnEdit"). Now the problem is that when I
press the update linkbutton, the datagrid calls my OnEdit function and when
I press the cancel linkbutton, the datagrid calls nothing in my code and it
cancels the edit mode.... One more thing, every event, the OnCommand handler
is called except the OnCancel...

Any help?

Here's the definiction of the datagrid

<aspataGrid ID="CuentasDG"
HorizontalAlign="Center"
AutoGenerateColumns="False"
CellPadding="3"
OnUpdateCommand="Cuentas_OnUpdate"
OnCancelCommand="Cuentas_OnCancel"
OnItemDataBound="Cuentas_OnItemDataBound"
OnEditCommand="Cuentas_OnEdit"
OnItemCommand="Cuentas_OnCommand"
Runat="server" >

And each Cuentas_On... is defined as:
protected void Cuentas_OnEdit( object sender, DataGridCommandEventArgs e )

protected void Cuentas_OnUpdate( object sender, DataGridCommandEventArgs e )

protected void Cuentas_OnCancel( object sender, DataGridCommandEventArgs e )

protected void Cuentas_OnCommand( object sender, DataGridCommandEventArgs
e )






 
Reply With Quote
 
 
 
 
Yunus Emre ALP÷ZEN [MCAD.NET]
Guest
Posts: n/a
 
      05-14-2005
every time itemcommand is called but u can control flow by checkin
commandname identifies command. And the other question,
Are u sure you give true command names for link buttons causes datagrid
events ???

--

Thanks,
Yunus Emre ALP÷ZEN
BSc, MCAD.NET

"Jaime" <j@j> wrote in message news:(E-Mail Removed)...
> Hi all,
>
> I have a datagrid with 2 databound columns and one EditCommandColumn, now
> when I press the edit link, the correct OnEditCommand event is generated
> and my user defined function is called (I'm sepcifying the name of the
> function in the datagrid OnEditCommand="OnEdit"). Now the problem is that
> when I press the update linkbutton, the datagrid calls my OnEdit function
> and when I press the cancel linkbutton, the datagrid calls nothing in my
> code and it cancels the edit mode.... One more thing, every event, the
> OnCommand handler is called except the OnCancel...
>
> Any help?
>
> Here's the definiction of the datagrid
>
> <aspataGrid ID="CuentasDG"
> HorizontalAlign="Center"
> AutoGenerateColumns="False"
> CellPadding="3"
> OnUpdateCommand="Cuentas_OnUpdate"
> OnCancelCommand="Cuentas_OnCancel"
> OnItemDataBound="Cuentas_OnItemDataBound"
> OnEditCommand="Cuentas_OnEdit"
> OnItemCommand="Cuentas_OnCommand"
> Runat="server" >
>
> And each Cuentas_On... is defined as:
> protected void Cuentas_OnEdit( object sender, DataGridCommandEventArgs e )
>
> protected void Cuentas_OnUpdate( object sender, DataGridCommandEventArgs
> e )
>
> protected void Cuentas_OnCancel( object sender, DataGridCommandEventArgs
> e )
>
> protected void Cuentas_OnCommand( object sender, DataGridCommandEventArgs
> e )
>
>
>
>
>
>



 
Reply With Quote
 
 
 
 
Elton W
Guest
Posts: n/a
 
      05-14-2005
It seems that the viewstate of the datagrid is false.
Disabled viewstate often causes the datagrid not work
properly.

HTH

Elton Wang
http://www.velocityreviews.com/forums/(E-Mail Removed)


>-----Original Message-----
>Hi all,
>
>I have a datagrid with 2 databound columns and one

EditCommandColumn, now
>when I press the edit link, the correct OnEditCommand

event is generated and
>my user defined function is called (I'm sepcifying the

name of the function
>in the datagrid OnEditCommand="OnEdit"). Now the problem

is that when I
>press the update linkbutton, the datagrid calls my OnEdit

function and when
>I press the cancel linkbutton, the datagrid calls nothing

in my code and it
>cancels the edit mode.... One more thing, every event,

the OnCommand handler
>is called except the OnCancel...
>
>Any help?
>
>Here's the definiction of the datagrid
>
> <aspataGrid ID="CuentasDG"
> HorizontalAlign="Center"
> AutoGenerateColumns="False"
> CellPadding="3"
> OnUpdateCommand="Cuentas_OnUpdate"
> OnCancelCommand="Cuentas_OnCancel"
> OnItemDataBound="Cuentas_OnItemDataBound"
> OnEditCommand="Cuentas_OnEdit"
> OnItemCommand="Cuentas_OnCommand"
> Runat="server" >
>
>And each Cuentas_On... is defined as:
>protected void Cuentas_OnEdit( object sender,

DataGridCommandEventArgs e )
>
>protected void Cuentas_OnUpdate( object sender,

DataGridCommandEventArgs e )
>
>protected void Cuentas_OnCancel( object sender,

DataGridCommandEventArgs e )
>
>protected void Cuentas_OnCommand( object sender,

DataGridCommandEventArgs
>e )
>
>
>
>
>
>
>.
>

 
Reply With Quote
 
Jaime
Guest
Posts: n/a
 
      05-14-2005
Hi,

Well actually I'm using

<asp:EditCommandColumn EditText="Edit" CancelText="Cancel"
UpdateText="Update" HeaderText="Edit" />

to generate the linkbuttons....

I've some more details....

I'm using my own page template framework and this is what seems to be
causing the problem, but I can't figure out why. my template framework is
something like:

public class BasePage : System.Web.Ui.Page
{
public BasePage()
{}

protected override void OnLoad(EventArgs e)
{
this.Controls.AddAt( 0, LoadControl( "Header.ascx" ) );
base.OnLoad( e );
this.Controls.Add( LoadControl( "Footer.ascx: ) );
}
}

and the derived page is

public class MyPage : BasePage
{
private void Page_Load(...)
{
if( !IsPostBack )
BindData()
}

protected BindData()
{
// get the data from the database
}

public void OnUpdate(...)
{
// this one never gets called
}
}


"Yunus Emre ALP÷ZEN [MCAD.NET]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> every time itemcommand is called but u can control flow by checkin
> commandname identifies command. And the other question,
> Are u sure you give true command names for link buttons causes datagrid
> events ???
>
> --
>
> Thanks,
> Yunus Emre ALP÷ZEN
> BSc, MCAD.NET
>
> "Jaime" <j@j> wrote in message
> news:(E-Mail Removed)...
>> Hi all,
>>
>> I have a datagrid with 2 databound columns and one EditCommandColumn, now
>> when I press the edit link, the correct OnEditCommand event is generated
>> and my user defined function is called (I'm sepcifying the name of the
>> function in the datagrid OnEditCommand="OnEdit"). Now the problem is that
>> when I press the update linkbutton, the datagrid calls my OnEdit function
>> and when I press the cancel linkbutton, the datagrid calls nothing in my
>> code and it cancels the edit mode.... One more thing, every event, the
>> OnCommand handler is called except the OnCancel...
>>
>> Any help?
>>
>> Here's the definiction of the datagrid
>>
>> <aspataGrid ID="CuentasDG"
>> HorizontalAlign="Center"
>> AutoGenerateColumns="False"
>> CellPadding="3"
>> OnUpdateCommand="Cuentas_OnUpdate"
>> OnCancelCommand="Cuentas_OnCancel"
>> OnItemDataBound="Cuentas_OnItemDataBound"
>> OnEditCommand="Cuentas_OnEdit"
>> OnItemCommand="Cuentas_OnCommand"
>> Runat="server" >
>>
>> And each Cuentas_On... is defined as:
>> protected void Cuentas_OnEdit( object sender, DataGridCommandEventArgs
>> e )
>>
>> protected void Cuentas_OnUpdate( object sender, DataGridCommandEventArgs
>> e )
>>
>> protected void Cuentas_OnCancel( object sender, DataGridCommandEventArgs
>> e )
>>
>> protected void Cuentas_OnCommand( object sender, DataGridCommandEventArgs
>> e )
>>
>>
>>
>>
>>
>>

>
>



 
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
Dynamic EditCommandColumn events Bruce E. Bonsall ASP .Net Datagrid Control 5 05-11-2005 03:36 AM
DataGrid EditCommandColumn not firing events properly. Rick ASP .Net 1 02-02-2004 05:03 AM
DataGrid EditCommandColumn not firing events properly. Rick ASP .Net Datagrid Control 1 02-02-2004 05:03 AM
DataGrid EditCommandColumn not firing events properly. Richard Ryerson ASP .Net Datagrid Control 0 01-28-2004 06:50 PM
DataGrid EditCommandColumn not firing events properly. Richard Ryerson ASP .Net 0 01-28-2004 06:50 PM



Advertisments