Calling a DataBind method on a webform in an ascx file

G

Guest

Hey everyone. I was wondering if someone could help me with a small problem.
I have designed a user control and I would have inserted it on a aspz page
(WebForm1). The User control is being used to help with the navigation
through a datagrid. The control handles all the paging issues and on the
webform I do all the DataBinding.

My problem is that at the end of code of an on-click event for a link button
on my user control (DataGridNavigation.ascx) I need to call the DataBind
Method. The problem is that the DataBind method is sitting on the WebForm1
code behind page.

Here is a part of my code on the Code behind in the user control (ascx.cs
file) and commented is here I need to call the DataBind method.

private void No1_Click(object sender, System.EventArgs e)
{
_currentPageNumber = int.Parse(No1.Text);
this.CurrentPage.Text = _currentPageNumber.ToString();
ShowHideNavigation();
/*Need to call the DataBind method in here somehow
This DataBind Method is sitting on the WebForm1 code behind page*/
}

I would be very grateful if someone could help me please.
 
O

Ollie

define a delegate and then define an event and when the link is clicked fire
the event.
The event should then been caught in the page containing the ascx control
and you can re-bind the control as required.

HTH

Ollie Riches
 

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

Top