Get input Value from Repeater with Request.Item

Pedro

this question may have been asked around before but somehow i can't find the awsner...

On my Default.aspx i have a repeater, that i put data on it with Databinder.Eval.

But what i want to do next is after i click the Image i want a Response of the values in inputs (hidden) that are next the images.

Here is my code:

<form id="form1" runat="server">
        <div class="container-fluid">
            <table class="table-hover" style="margin: 20px auto;">
                <asp:Repeater ID="rpRow" runat="server">
                    <ItemTemplate>
                        <tr>
                            <td>
                                <img style="margin: 5px;" id="ImageBar" src="<%# DataBinder.Eval(Container.DataItem, "ImageBar")%>" onclick="<%= _imgPostBackCall %>;"/>
                                <input id="PromoID_<%# DataBinder.Eval(Container.DataItem, "PromoID")%>" type="hidden" name="PromoID" value="<%# DataBinder.Eval(Container.DataItem, "PromoID")%>" />
                                <input id="PromoCode_<%# DataBinder.Eval(Container.DataItem, "PromoCode")%>" type="hidden" name="PromoCode" value="<%# DataBinder.Eval(Container.DataItem, "PromoCode")%>" />
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:Repeater>
            </table>
        </div>
    </form>

Code behind:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        _imgPostBackCall = ClientScript.GetPostBackEventReference(Me, "")

        If Not Me.IsPostBack Then

            'DataTable
            Dim dt_Data As DataTable = PromoDL.GetPromo()

            'Table list
            rpRow.DataSource = dt_Data
            rpRow.DataBind()

            dt_Data.Dispose()
        Else
            'Event Click


            Dim PromoID As String = Request.Item("PromoID")
            Dim PromoCode As String = Request.Item("PromoCode")
            Response.Write("PromoID: " & PromoID & " PromoCode: " & PromoCode)
        End If
    End Sub

What i get on Response is something like this

PromoID: 3,1 PromoCode: BFC40,BFCN20

(Which are the 2 rows i have on my DB), but what i want is it to appear like this

PromoID: 3 PromoCode: BFC40

(which corresponds to what image i clicked)

Pedro

Nevermind I was making things way more complicated. All i needed to do was put an <a> inside the repeater, like this:

    <form id="form1" runat="server">
        <div class="container-fluid">
            <table class="table-hover" style="margin: 20px auto;">
                <asp:Repeater ID="rpRow" runat="server">
                    <ItemTemplate>
                        <tr>
                            <td>
                                <a href="Promo.aspx?Code=<%# DataBinder.Eval(Container.DataItem, "PromoCode")%>">
                                    <img style="margin: 5px;" id="<%# DataBinder.Eval(Container.DataItem, "PromoCode")%>" src="<%# DataBinder.Eval(Container.DataItem, "ImageBar")%>" />
                                </a>
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:Repeater>
            </table>
        </div>
    </form>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Get a value from Repeater in code-behind

From Dev

How to get Footer Item value on code behind with nested Repeater?

From Dev

How to get/access row value from Repeater using jquery?

From Dev

WordPress Advanced Custom Fields Get value from Checkbox Within Repeater

From Dev

How to get/access row value from Repeater using jquery?

From Dev

WordPress Advanced Custom Fields Get value from Checkbox Within Repeater

From Dev

Get a value from an input field

From Dev

Get value from input in NodeJS

From Dev

Get the value of an input from a button

From Dev

Get a value from an input field

From Dev

Get value from input in NodeJS

From Dev

Change format of value in input from AJAX request

From Dev

Delete an item from an asp:Repeater using jQuery

From Dev

Tornado get input from URL request

From Dev

Get input name from request, Laravel

From Dev

Get Value from URL - GET Request

From Dev

I want to get drowpdown value from repeater in code how to get it in asp.net?

From Dev

Get attribute value from a selected item in a list

From Dev

Get item with value from tuple in python

From Dev

How to get a custom value from an array item

From Dev

XAML Get Item text value from ListViewItem

From Dev

Get attribute value from a selected item in a list

From Dev

Get selected item value from ListView CustomAdapter

From Dev

Get element by repeater with specific value in Protractor?

From Dev

How to get the value of "Label" inside the repeater?

From Dev

How to get the value of "Label" inside the repeater?

From Dev

How to get the value of the currently selected Selectize.js input item

From Dev

Get average value from NSManagedObject request array

From Dev

Jmeter extract value from Get Request

Related Related

  1. 1

    Get a value from Repeater in code-behind

  2. 2

    How to get Footer Item value on code behind with nested Repeater?

  3. 3

    How to get/access row value from Repeater using jquery?

  4. 4

    WordPress Advanced Custom Fields Get value from Checkbox Within Repeater

  5. 5

    How to get/access row value from Repeater using jquery?

  6. 6

    WordPress Advanced Custom Fields Get value from Checkbox Within Repeater

  7. 7

    Get a value from an input field

  8. 8

    Get value from input in NodeJS

  9. 9

    Get the value of an input from a button

  10. 10

    Get a value from an input field

  11. 11

    Get value from input in NodeJS

  12. 12

    Change format of value in input from AJAX request

  13. 13

    Delete an item from an asp:Repeater using jQuery

  14. 14

    Tornado get input from URL request

  15. 15

    Get input name from request, Laravel

  16. 16

    Get Value from URL - GET Request

  17. 17

    I want to get drowpdown value from repeater in code how to get it in asp.net?

  18. 18

    Get attribute value from a selected item in a list

  19. 19

    Get item with value from tuple in python

  20. 20

    How to get a custom value from an array item

  21. 21

    XAML Get Item text value from ListViewItem

  22. 22

    Get attribute value from a selected item in a list

  23. 23

    Get selected item value from ListView CustomAdapter

  24. 24

    Get element by repeater with specific value in Protractor?

  25. 25

    How to get the value of "Label" inside the repeater?

  26. 26

    How to get the value of "Label" inside the repeater?

  27. 27

    How to get the value of the currently selected Selectize.js input item

  28. 28

    Get average value from NSManagedObject request array

  29. 29

    Jmeter extract value from Get Request

HotTag

Archive