I have a RadStrip in my page. Inside RadStrip, i am placing Raddocks, in which a UserControl page is populated.
Now in my UserControl ascx page, i have an Hyperlink.
While i Click on this Hyper link, its not hitting the events in UserControl ascx page. instead of that, i am getting reposted to same page
Main Page
RadDock dock6 = CreateRadDock();
dock6.Title = "Last Viewed Claims";
_userControl = LoadControl("~/pages/UserControl.ascx");
dock6.ContentContainer.Controls.Add(_userControl);
RadDockZone dz6 = (RadDockZone) RadDockZone1;
RadDockLayout1.Controls.Add(dock6);
dock6.Dock(dz6);
UserControl.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UserControl.ascx.cs"
EnableViewState="true" Inherits="UserControl" %>
<table border="0" width="100%">
<tr>
<td>
<asp:ListView ID="lvmydata" runat="server" >
<ItemTemplate >
<tr>
<td>
<asp:LinkButton ID="label1" runat="server" Text='<%# Eval("ID")%>'
OnClick="linkClick">
</asp:LinkButton>
</td>
</tr>
</ItemTemplate>
</asp:ListView>
</td>
</tr>
</table>
UserControl.ascx.cs
public IList MyData
{
set
{
_myData = value;
lvmyData.DataSource = _myData;
lvmyData.DataBind();
}
}
get { return _lastViewedClaimsList; }
}
protected void linkClick(object sender, EventArgs e)
{
LinkButton btn = (LinkButton) sender;
btn.CommandArgument = btn.Text;
}
Add IDs to the controls you create dynamically and make sure you recreate them properly with each postback, preferably in the Page_Init event.
_userControl = LoadControl("~/pages/UserControl.ascx");
_userControl.ID = "theUserControlID";//that should not change across postbacks
dock6.ContentContainer.Controls.Add(_userControl);
//make sure the dock also has an ID that does not change