Solved

Store Repeater value in variable...

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

839 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