The jump Column Binding format of the gridview in Asp.net

Source: Internet
Author: User

<Asp: templatefield headerstyle-horizontalalign = "center">
<Headertemplate>
Number of assigned classes
</Headertemplate>
<Itemtemplate>
<Asp: Label id = "lblclasscount"
TEXT = '<% # computeclasscount (eval ("courseid") %> 'runat = "server"> </ASP: Label>
</Itemtemplate>
</ASP: templatefield>
<Asp: templatefield headerstyle-horizontalalign = "center">
<Headertemplate>
Allocate class
</Headertemplate>
<Itemtemplate>
<Asp: linkbutton id = "linkbtn" onclientclick = '<% # "javascript: Return checkproject (" + computeprojectcount (eval ("courseid") + ");" %>'
Postbackurl = '<% # eval ("courseid", "courseclass. aspx? Courseid = {0} ") %> 'runat =" server "> assign a class </ASP: linkbutton>
</Itemtemplate>
</ASP: templatefield>
<% -- <Asp: hyperlinkfield headertext = "" datanavigateurlfields = "courseid" datanavigateurlformatstring = "courseclass. aspx? Courseid = {0 }"

TEXT = "Assign class"> </ASP: hyperlinkfield> -- %>

Example 1 of URL formatting:

<Asp: templatecolumn>
<Itemtemplate>
<Asp: hyperlink runat = "server" text = "view photo" navigateurl = '<% # string. Format ("photo. aspx? Empid = {0} & Path = {1} ", Eval (" employeeid "), Eval (" photopath ") %> '> </ASP: hyperlink>
</Itemtemplate>
</ASP: templatecolumn>

URL format Example 2:

<Asp: hyperlinkfield datanavigateurlfields = "employeeid, city" datanavigateurlformatstring = "photo. aspx? Empid = {0} & Path = {1 }"
Headertext = "photopath" text = "view photo"/>

When a linkbutton is bound with a parameter, there are other methods:

A: onclientclick = '<% # string. format ("Return JSF (\" {0} \ ", \" {1} \ ")", Eval ("Domain"), Eval ("siteid ")) %> '>

B: onclientclick = '<% # eval ("Domain", "Return JSF (\" {0} \ ")") %>'

C: onclientclick = '<% # "javascript: Return JSF (" + eval ("ID") + ");" %>'

Domain, siteid, and Id are the names of the columns in the outer dataset. JSF is the JavaScript function name.

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.