i have a datalist inside a tabcontainer. I need to display data from database into the datalist as hyperlink, and when i click on any of that link it should navigate to another page and to display data according to that link.
i have tried and it works fine when the datalist is not placed inside the tabcontainer, but when i put datalist inside tab container the "OnItemdatabound " event does't fire.
here is the code.
--------------------C# File------------------------------------
Expand|Select|Wrap|Line Numbers
- protected void Page_Load(object sender, EventArgs e)
- {
- DataSet myds = new DataSet();
- da.Fill(myds);
- DataList1.DataSource = myds;
- DataList1.DataBind();
- }
- protected void datalist1(object sender, DataListItemEventArgs e)
- {
- HyperLink hpclk = (HyperLink)(e.Item.FindControl("hlpnews"));
- hpclk.NavigateUrl = "~/NewFolder1/main.aspx?Username="+ hpclk.Text;
- }
Expand|Select|Wrap|Line Numbers
- <asp:DataList ID="DataList1" runat="server" BorderColor = "Black" OnItemDataBound="datalist1">
- <ItemTemplate>
- <asp:HyperLink runat ="server" ID="hlpnews" text='<%#DataBinder.Eval(Container.DataItem,"Username") %>' >
- </asp:HyperLink>
- </ItemTemplate>
- </asp:DataList>
the above code works fine for a datalist outside the tabcontainer, but does't work for 1 inside the container.
any one can help plz,