hi everybody,
this is my asp code :
<asp:RepeaterID="ctlRep"runat="server"OnItemDataBound="Repeater1_ItemDataBound"><HeaderTemplate><ulclass="rssList"></HeaderTemplate><FooterTemplate></ul></FooterTemplate><ItemTemplate><li><asp:Label ID="Label2" runat="server" Text='<%# Eval("title")%>' Visible="false"></asp:Label><asp:Label ID="Label3" runat="server" Text='<%# Eval("description")%>' Visible="false"></asp:Label><asp:Label ID="Label4" runat="server" Text='<%# Eval("link")%>' Visible="false"></asp:Label></ItemTemplate></asp:Repeater>
and in my code behind :
protectedvoidButton1_Click(object sender,EventArgs e){Label lblTitre =(Label)ctlRep.Items[0].FindControl("Label2");Label lblDetail =(Label)ctlRep.Items[0].FindControl("Label3");Label lblLink =(Label)ctlRep.Items[0].FindControl("Label4");SqlCommand cmd =newSqlCommand("insert into information values ('"+ lblTitre.Text.Replace("'","''")+"','"+ lblDetail.Text.Replace("'","''")+"','"+ lblLink.Text.Replace("'","''")+"','USER')", con); cmd.ExecuteNonQuery(); con.Close();}
i wanna to save the informations of a rss feed , but when i click in my button , it's always saving the first item ( information ) of the rss feed , i know the problem is here : ctlRep.Items[0] . i found that i can use this ( <%#Container.ItemIndex;%> ) , but i have no idea of how to use it :s
for example i want to save the sixth item of my rss fedd , but how to recuperate the index ? can you help me please?