Sorry for that I really did not have the definite ideas for automatically calling one event from the code-behind after having carefully checked your postings.
I only need the way to automatically fire/trigger one event in the code-behind from the gridview.
But the buttons, like 'Edit'/'Update', come together with the Gridview, and are not defined by us. How to add event for that? How do we know which object ID it is?
Could you pls answer me why the above event could not be fired? If that was fired, why is there no help by giving the parameters?
Many thanks Mak. The article does talk about the Rowupdating/RowDeleting events of the gridview. But simply, why won't the following event be fired and then give any help by providing the parameters, for the Gridview? (ds_my_det is just the name of the gridview)
Very very sorry for being unable to close this issue for long time.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Text;
using System.Data.SqlClient;
using System.Configuration;
using System.Data.OracleClient;
namespace Newst
{
public partial class my_det : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: Cannot convert type 'System.Web.UI.Control' to ...
May 25, 2009 07:30 AM|LINK
You will have to use a update button for that
Contact me
wmec
Contributor
6195 Points
3214 Posts
Re: Cannot convert type 'System.Web.UI.Control' to ...
May 25, 2009 07:40 AM|LINK
By the given button of that gridview? How?
HuaMin Chen
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: Cannot convert type 'System.Web.UI.Control' to ...
May 25, 2009 07:59 AM|LINK
As same in that article I have given earlier
Contact me
wmec
Contributor
6195 Points
3214 Posts
Re: Cannot convert type 'System.Web.UI.Control' to ...
May 25, 2009 08:06 AM|LINK
Sorry for that I really did not have the definite ideas for automatically calling one event from the code-behind after having carefully checked your postings.
I only need the way to automatically fire/trigger one event in the code-behind from the gridview.
HuaMin Chen
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: Cannot convert type 'System.Web.UI.Control' to ...
May 25, 2009 08:40 AM|LINK
What do you mean automatically?
If there's a button user clicks on it the event will be called
Contact me
wmec
Contributor
6195 Points
3214 Posts
Re: Cannot convert type 'System.Web.UI.Control' to ...
May 25, 2009 08:48 AM|LINK
But the buttons, like 'Edit'/'Update', come together with the Gridview, and are not defined by us. How to add event for that? How do we know which object ID it is?
Could you pls answer me why the above event could not be fired? If that was fired, why is there no help by giving the parameters?
HuaMin Chen
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: Cannot convert type 'System.Web.UI.Control' to ...
May 25, 2009 09:20 AM|LINK
For that there's a GridView editing event
have a look here this will surely clear all your doubts
http://www.aspdotnetcodes.com/GridView_Insert_Edit_Update_Delete.aspx
I donot have ready code other wise I would have given it
Contact me
wmec
Contributor
6195 Points
3214 Posts
Re: Cannot convert type 'System.Web.UI.Control' to ...
May 25, 2009 09:32 AM|LINK
Many thanks Mak. The article does talk about the Rowupdating/RowDeleting events of the gridview. But simply, why won't the following event be fired and then give any help by providing the parameters, for the Gridview? (ds_my_det is just the name of the gridview) Very very sorry for being unable to close this issue for long time.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Text;
using System.Data.SqlClient;
using System.Configuration;
using System.Data.OracleClient;
namespace Newst
{
public partial class my_det : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void ds_my_det_RowUpdating(object sender, EventArgs e)
{
LinkButton lnk = (LinkButton)sender;
GridViewRow curr_row = (GridViewRow)lnk.Parent.Parent;
ds_my_det.InsertParameters.Clear();
ds_my_det.InsertParameters.Add("title", curr_row.Cells[0].Text);
ds_my_det.InsertParameters.Add("start_dt", curr_row.Cells[1].Text);
ds_my_det.Insert();
}
}
}
I only expect to see that the event is being called and the parameters there will be further used for the gridview.
HuaMin Chen
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: Cannot convert type 'System.Web.UI.Control' to ...
May 25, 2009 10:45 AM|LINK
I'll suggest do what suggested in that article or download and use its code You may be missing something that's why your code is not called
Also you need to rebind the GridView after edit and updates So that it reflects the changes
Contact me
wmec
Contributor
6195 Points
3214 Posts
Re: Cannot convert type 'System.Web.UI.Control' to ...
May 26, 2009 08:07 AM|LINK
Many many thanks, Mak and good day. You can take your time and tell me once you've got any good news for the outstanding issue here.
HuaMin Chen