trant trum
trant trum

Reputation: 219

How to use Request.Form("id") for this?

I have a repeater control which displays id's.

<repeater id="a" runat ="server">

    <ItemTemplate>
        <asp:LinkButton ID="bt1" runat="server" PostBackUrl= '<%# "~/Default.aspx"?id=" + Container.DataItem.ToString() %>' /asp:LinkButton>
    </ItemTemplate>

</asp:Repeater>

In my default page I am able to access it like this.

Dim foo as String = Request.QueryString("id")

My question- How would I post the data. By post I mean not using query string because I don't want the id to show up in the url? Any help would be appreciated!

Upvotes: 0

Views: 976

Answers (1)

user3720856
user3720856

Reputation: 56

You are close. Postbackurl is infrequently used in asp.net. If you need to post data to a different page, it's useful, but not for simple postbacks.

When you are within a data binding control like a repeater, use the "commandargument" property of the linkbutton. You can then trap the value in the repeater's itemcommand event in the codebehind.

Here is an example:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linkbutton.commandargument(v=vs.110).aspx

Good luck!

Upvotes: 1

Related Questions