[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Store Repeater value in variable...

Posted on 2006-11-12
4
Medium Priority
?
591 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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
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 …
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

649 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