Solved

Store Repeater value in variable...

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

803 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