I have an asp.net page with a custom usercontrol which contains a selectable gridview, and a formview which is on the page directly.
First issue: I want the FormView s pageindex to be the selected index of the GridView. I can get the selectedindex of the GridView by doing this:
public virtual int SelectedIndex
{
get { return this.GridView1.SelectedIndex; }
set { this.GridView1.SelectedIndex = value; }
}
Then on my aspx page I can do this:
FormView1.PageIndex = CodeView1.SelectedInex;
The problem is that I can t seem to figure out how to call this function from within my aspx page for whenever I click the Select link of a row on my gridview. I ve assigned it to a button onclick just to make sure it works, and it does. I d just like to be able to do it from the gridview directly.
Second Issue
On the gridview (the same one as above), I have an itemtemplate for the select command which is an asp:linkbutton. Whenever I click the Select link on the gridview, all the formatting that I ve set up in the rowdatabound function gets undone.
For example, I have this in my rowdatabound:
HyperLink TicketDetailLink = new HyperLink();
TicketDetailLink.NavigateUrl = "TicketDetail.aspx?TicketNumber=" + TicketNumber;
TicketDetailLink.Text = TicketNumber;
e.Row.Cells[5].Controls.Add(TicketDetailLink);
But as soon as I click my select link, that hyperlink disappears. Thoughts?