.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal

Post New Resource Bookmark and Share   

Code for find controls inside a repeater and take the value on other page

Posted By:Ashutosh Jha       Posted Date: July 26, 2014    Points: 40    Category:    URL: http://www.dotnetspark.com  

This code will help you to find the control inside the repeater and upon click how to take value and other parameter to other page.

Design Page:

<asp:Repeater ID="RepDetails" runat="server" >
<asp:Label ID="lblid" runat="server" Text='<%#Eval("StateID")%>'></asp:Label>
<asp:LinkButton ID="lbstate" runat="server" CssClass="about" OnClick="lbstate_Click" Text='<%#Eval("StateName")%>'></asp:LinkButton>

Code Behind:-

protected void lbstate_Click(object sender, EventArgs e)

RepeaterItem item;
Label lbl1;
ControlCollection ctrls = RepDetails.Controls;
foreach (Control i in ctrls)

item = i as RepeaterItem;
lbl1 = item.FindControl("lblid") as Label;

Session["id"] = lbl1.Text;

Response.Redirect("PINStateDetails.aspx?id=" + lbl1.Text);



Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend