Solved

Store Repeater value in variable...

Posted on 2006-11-12
4
505 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
  • 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

706 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now