473,386 Members | 1,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

EditCommandColumn not genereting correct events

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

<asp:DataGrid 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 )


Nov 19 '05 #1
3 1940
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:uW**************@tk2msftngp13.phx.gbl...
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

<asp:DataGrid 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 )


Nov 19 '05 #2
It seems that the viewstate of the datagrid is false.
Disabled viewstate often causes the datagrid not work
properly.

HTH

Elton Wang
el********@hotmail.com

-----Original Message-----
Hi all,

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

Any help?

Here's the definiction of the datagrid

<asp:DataGrid 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, DataGridCommandEventArgse )


.

Nov 19 '05 #3
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]" <ye***@msakademik.net> wrote in message
news:uj**************@tk2msftngp13.phx.gbl...
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:uW**************@tk2msftngp13.phx.gbl...
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

<asp:DataGrid 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 )



Nov 19 '05 #4

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

Similar topics

18
by: Stanley J Mroczek | last post by:
I Set the EditCommandColumn to Visible=False to stop people who are not allowed to make any changes to a record. How can set it to Visible=true for some users? Please answer in VB Thanks Stan
4
by: RobS | last post by:
Can anyone answer this question: How can I disable validation when edit column update button is pressed. Can it be done for the whole grid? Regards, Robert
1
by: Rick | last post by:
Hello all, I hope all is well with you. I am having a seriously difficult time with this problem. Allow me to set up the problem. I have a System.Web.UI.Page with the following controls...
1
by: angus | last post by:
Dear All, I am using VB.net It is found that the <asp:EditCommandColumn/> wouldn't fired an event for OnEditCommand If pushbutton has been used: that is:
1
by: tshad | last post by:
I have a row like this that works fine: *************************************************************** <asp:DataGrid visible="False" border=1 id="DataGrid1" runat="server" Width="400px"...
4
by: Sourav Dutta Gupta | last post by:
I want to change the "scr" like src='images/Edit.ICO' to src='images/XYZ.ICO' dynamically based on some condition. My EditCommandColumn: <asp:EditCommandColumn ButtonType="LinkButton"...
0
by: CharlesA | last post by:
I've got this onn the left of my datagrid <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" HeaderText="Edit" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn> and...
6
by: Scott McDaniel | last post by:
I'm using Visual Studio 2005 with the .NET 2.0.50727 framework, and we're using the standard Datagrid control bound to a SQL Server. We have two groups of users - "full edit" users, and "view...
0
by: slemen | last post by:
Hi, The asp:EditCommandColumn template does not fire the _edit sutboutine when the edit command column buttons are clicked. I get a Page Cannot Be Displayed page error instead. My (ASP 1.1)...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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...

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.