user control Problem
-
Hi, I am using asp.net 2005. I have a problem with usercontrol. I have a usercontrol on my aspx page. In usercontrol there is a button. on click event of usercontol button i have to fill gridview which is present on aspx page. can any one tell me how i will do it. thanking u.
-
Hi, I am using asp.net 2005. I have a problem with usercontrol. I have a usercontrol on my aspx page. In usercontrol there is a button. on click event of usercontol button i have to fill gridview which is present on aspx page. can any one tell me how i will do it. thanking u.
-
well fire the event for filling the gridview on the onclick event of the button there are plenty of tutorials for binding data to a gridview and its fairly straightforward
We are not a Code Charity
thanks for replaying me. but the problem is my button is in usercontrol and gridview is in aspx page. how i fire event of usercontrol in aspx page. please tell me.
-
thanks for replaying me. but the problem is my button is in usercontrol and gridview is in aspx page. how i fire event of usercontrol in aspx page. please tell me.
check this out: http://forums.asp.net/p/1279478/2441374.aspx and this http://forums.asp.net/p/1262933/2365263.aspx
We are not a Code Charity
-
thanks for replaying me. but the problem is my button is in usercontrol and gridview is in aspx page. how i fire event of usercontrol in aspx page. please tell me.
Hi, Sorry for the delay...there was a problem in the site.. You need to raise an event to the page. Here is how to do it. First let’s create delegate and define an event of type of the delegate. And call that event in the button click event. Add this code your ascx.cs file public delegate void LoadGridHandler(); public event LoadGridHandler LoadGrid; protected void Button1_Click(object sender, EventArgs e) { this.LoadGrid(); } Now, in your aspx file, raise that event during the page load of your page. Take this code.. protected void Page_Load(object sender, EventArgs e) { MyControl1.LoadGrid += new Controls_MyControl.LoadGridHandler(MyControl1_LoadGrid); } void MyControl1_LoadGrid() { //write the method to load you grid Response.Write("Hi from Gayani"); } Hope it works Thx, Gayani
-
Hi, Sorry for the delay...there was a problem in the site.. You need to raise an event to the page. Here is how to do it. First let’s create delegate and define an event of type of the delegate. And call that event in the button click event. Add this code your ascx.cs file public delegate void LoadGridHandler(); public event LoadGridHandler LoadGrid; protected void Button1_Click(object sender, EventArgs e) { this.LoadGrid(); } Now, in your aspx file, raise that event during the page load of your page. Take this code.. protected void Page_Load(object sender, EventArgs e) { MyControl1.LoadGrid += new Controls_MyControl.LoadGridHandler(MyControl1_LoadGrid); } void MyControl1_LoadGrid() { //write the method to load you grid Response.Write("Hi from Gayani"); } Hope it works Thx, Gayani
thanks a lot. i fixed my problem.