LinkButton Passing parameters

Source: Internet
Author: User
Tags bind eval

Now you have done a few things! found that a lot of stuff is universal. It's a lot of time to go through the previous examples and see what the code looks like and see how that function is implemented.

Now let's LinkButton the usage of the pass parameter.

This usage can be used to modify a product, delete a product when passing the parameter ID

The foreground code is as follows, if you want to bind the control data source.

<asp:linkbutton id= "Delete" runat= "server" text= "Delete this product" commandargument= ' <% #Eval ("ID")%> ' onclick= ' DEL_ Click "></asp:LinkButton>

CommandArgument is used to bind a passed parameter, and the code to get the parameter in the background is as follows

protected void Del_click (object sender, EventArgs e) {LinkButton alter = (LinkButton) sender;//delete is LinkButton ID ca_id = Convert.ToInt32 (alter.commandargument); }

This way, you can implement the parameters passed!!!! Write so much first, catch the code.

Ha ha... I just found a good thing.

It's about passing multiple values ...

CommandArgument = ' <% #Eval ("id") + "," +eval ("id")%> '

Remember, there is only one <%#%>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.