troubleshooting Question

Saving repeater textbox value in a session

Avatar of Camillia
CamilliaFlag for United States of America asked on
ASP.NET
4 Comments1 Solution876 ViewsLast Modified:
I have a repeaer below. I bind to it from database.
1. User types something in the textbox area. This is page1.aspx
2. I click a button, go to another page. This is page2.aspx
3. I do something on that page2.aspx and go back to page1.aspx

Now, before I leave page1.aspx, I want to save the text user entered in repeater's textbox. How can I do this? This is what I have so far:

 <asp:Repeater runat="server" ID="rptProvider" OnItemDataBound="rptProivder_ItemDataBound">
            <ItemTemplate>
              <asp:Literal runat="server" ID="lProviderId" Visible="false" Text='<%# DataBinder.Eval(Container.DataItem, "Id") %>' ></asp:Literal>
              
              <asp:TextBox name="reason" runat="server" id="reason" style="max-width: 310px;" cols="41" rows="5" ></asp:TextBox>
              
            </ItemTemplate>
           </asp:Repeater>

I think when I click on the button on page1.aspx to leave that page, I need to loop thru the
repeater and save the textbox but not sure how to do that:

 foreach(RepeaterItem rptItem in rptProvider.Items)
          {
              TextBox reason = (TextBox)rptItem.FindControl("reason");
              Literal reason = (Literal)rptItem.FindControl("lProviderId");
              
             //i have the ID for each row and the reason textbox. But how I save it in session?
          }
ASKER CERTIFIED SOLUTION
dejaanbu

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros