<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.