Solved

Store Repeater value in variable...

Posted on 2006-11-12
4
550 Views
Last Modified: 2008-01-16
I really need someone's help with this!!  

I am trying to figure out how to store the value of a piece of data produced by the Repeater I have.  Here is the ASP.NET code for the Repeater:

<asp:Repeater ID="orderhistorylist" runat="server">
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td align="center" valign="top">
<a target="_blank" href='<%#m_StoreLoc & "receipt.aspx?ordernumber=" & DataBinder.Eval(Container.DataItem, "OrderNumber")%>'><%#DataBinder.Eval(Container.DataItem, "OrderNumber").ToString()%></a>
<%#GetReorder(DataBinder.Eval(Container.DataItem, "OrderNumber").ToString())%>
</td>
<td align="center" valign="top"><%#AspDotNetStorefrontCommon.Localization.ToNativeDateTimeString(Convert.ToDateTime(DataBinder.Eval(Container.DataItem, "OrderDate"), SqlServerCulture))%></td>
<td align="center" valign="top"><%#GetPaymentStatus(DataBinder.Eval(Container.DataItem, "PaymentMethod").ToString(), DataBinder.Eval(Container.DataItem, "CardNumber").ToString(), DataBinder.Eval(Container.DataItem, "TransactionState").ToString())%></td>
<td align="center" valign="top"><%#GetShippingStatus(Convert.ToInt32(DataBinder.Eval(Container.DataItem, "OrderNumber").ToString()), DataBinder.Eval(Container.DataItem, "ShippedOn").ToString(), DataBinder.Eval(Container.DataItem, "ShippedVIA").ToString(), DataBinder.Eval(Container.DataItem, "ShippingTrackingNumber").ToString(), DataBinder.Eval(Container.DataItem, "TransactionState").ToString(), DataBinder.Eval(Container.DataItem, "DownloadEMailSentOn").ToString())%></td>
<td align="center" valign="top"><%#GetOrderTotal(Convert.ToInt32(DataBinder.Eval(Container.DataItem, "QuoteCheckout").ToString()), DataBinder.Eval(Container.DataItem, "PaymentMethod").ToString(), DataBinder.Eval(Container.DataItem, "OrderTotal").ToString(), Convert.ToInt32(DataBinder.Eval(Container.DataItem, "CouponType").ToString()), DataBinder.Eval(Container.DataItem, "CouponDiscountAmount").ToString())%></td>
<td align="center" valign="top"><%#GetCustSvcNotes(DataBinder.Eval(Container.DataItem, "CustomerServiceNotes").ToString())%></td>
<td align="center" valign="middle">
                                                   
                                                   
                                                   
<asp:Button ID="btnPlaceReturn" runat="server" Text="Place Return" OnClick="ReturnPage" commandname='<%# Container.DataItem("OrderNumber") %>'/>
                                                     
</tr>
</ItemTemplate>
<FooterTemplate></FooterTemplate>
                                          
</asp:Repeater>


I'm trying to figure out how to store the value of the "OrderNumber" value into a variable called OrderNumber.  What I'm trying to do ultimately is to pass the value of the variable to another page.  The user clicks the button called "btnPlaceReturn" the the "ReturnPage" is the subroutine that displays the next page.  Here is the code for that.

Sub ReturnPage(ByVal sender As Object, ByVal e As EventArgs)
            Dim OrdersCount, Count, i As Integer
            Dim test As String
            'Dim SQLCMD As SqlClient.SqlCommand = New SqlClient.SqlCommand
            'Dim SQLCONN As SqlClient.SqlConnection = New SqlClient.SqlConnection("Server=CITMPOWERMERCH;Initial Catalog=aarpmarketplace_prod;Integrated Security=True")
            'SQLCMD.Connection = SQLCONN
            'SQLCMD.CommandText = "SELECT COUNT(OrderNumber) FROM Orders WHERE CustomerID='" & ThisCustomer.CustomerID & "'"
            'SQLCONN.Open()
            'OrdersCount = SQLCMD.ExecuteScalar()
            test = orderhistorylist.Items.Item(0).DataItem.ToString
            i = OrdersCount
            Dim OrderNumber(10) As Integer

            'SQLCMD.CommandText = "SELECT OrderNumber FROM Orders WHERE CutomerID='" & ThisCustomer.CustomerID & "'"
            'For Count = 0 To OrdersCount
            '    OrderNumber(Count) = SQLCMD.ExecuteScalar
            'Next

            Context.Items("OrderCount") = OrdersCount
            Context.Items("OrderNumber") = test
            Server.Transfer("placereturn.aspx")
            Response.Redirect("placereturn.aspx")
        End Sub

Everything I've tried, doesn't work.  Please help!!  This is VERY important for me to fix before tomorrow morning.
0
Comment
Question by:convertix
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 

Author Comment

by:convertix
ID: 17926666
Anyone???
0
 
LVL 4

Accepted Solution

by:
darkpriest earned 500 total points
ID: 17927844
This is a GridView example but the idea is the same, just replace the gridview commands with the equivlant repeater syntax.

First off You have your <asp:Button ID="retr... > wrong.

  <ItemTemplate>
                            <asp:ImageButton ID="resend" runat="server" CommandName="Resend" AlternateText="resend"
                                CausesValidation="false" CommandArgument='<%# Eval("ID") %>' ImageUrl="../images/albumbuttons/resend_invite.gif" />
                        </ItemTemplate>

Then have somet like this you'd replace your Handles command to which ever yours is.  Of course replace a GridView with the equivleant Repeater

 Protected Sub addressBook_RowCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles addressBook.RowCommand

        If e.CommandName = "Resend" Then

            parseEmailtoContact(e.CommandArgument)

'Your command argument would be the value that you passed through which in your case it would be
<%#DataBinder.Eval(Container.DataItem, "OrderNumber")



        Else

        End If

    End Sub

ParseEmailtoContact is just a function i have to pass through too

but you'd go something like

parseEmail(Byval OrderID as integeR)

Then your OrderID is assigned by the argument passed, then you can continue to use it
0
 

Author Comment

by:convertix
ID: 17928017
Thank you, that worked perfectly!  Well done!
0
 
LVL 4

Expert Comment

by:darkpriest
ID: 17928033
Glad it worked.  It took me a while to figure out when i first wrote it.
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question