Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello I would be grateful if you could help me to solve the problem.

I created LinkButton that located inside of Repeater Control. CategoryID is a variable in LinkButton Control that have to get value after Repeater Control was bound to data. But CategoryID always get zero.

I have the following ASP and C# code:

ASP.NET
<asp:Repeater ID="rpt1" runat="server" 
    OnItemDataBound="rpt1_ItemDataBound" 
    OnItemCommand="rpt1_ItemCommand">    

 <div><%# Eval("Name") %>-<%# Eval("CollectionType")%>
 <asp:LinkButton ID="LinkButton1" runat="server" Text="[edit item]"  PostBackUrl='AddItem.aspx?CategoryID=<%# Eval("CollectionID")%>' /> 

  </div>     
  </ItemTemplate> 
 </asp:Repeater>


Code behind:
C#
public void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        List<GlassesCollection> gc = BL.GetDataBL.GetCollection();
        rpt1.DataSource = gc;
        rpt1.DataBind();
    }
}


Any idea why CategoryID variable dosen't get any value and how can i fix the problem?

Thank you in advance!
Posted
Comments
[no name] 28-Jan-12 19:39pm    
Where are you checking for the query string parameter? I don't see it.
Mich_90 28-Jan-12 22:34pm    
I check it in another page

1 solution

What are you doing to persist the state from this page to the other page where you are trying to get the value? Unless you POST to that page, it would not necessarily have access to variables on this page, unless you were doing something else to get the value there.

Can we see what you are doing to get to the other page, and what the other page is doing to read the value?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900