ASP.NET GridViewµÄʹÓÃÏê½â
ÕâÊÇҪʵÏֵŦÄÜ£º
µÚÒ»²½£ºÍÏÈëGridView¿Ø¼þ ²¢ÇÒÍê³É²éѯËùÓÐÊý¾ÝµÄ·½·¨ ͨ¹ýthis.GridView1.DataSource »ñÈ¡¼¯ºÏÊý¾Ý GridView1.DataBind() °ó¶¨Êý¾Ý
µÚ¶þ²½£ºÊµÏÖÈ«Ñ¡¹¦ÄÜ
1. Ò³Ãæ´úÂ룺
´úÂë
<asp:TemplateField HeaderText="È«Ñ¡">
<HeaderTemplate>
<input type="checkbox" id="CheckBox1" name="CheckBox1" onclick="GetAllCheckBox(this)" />
È«Ñ¡
</HeaderTemplate>
<ItemTemplate>
<input type="checkbox" name="CheckBox2" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" Width="100px" />
</asp:TemplateField>
2. ʵÏÖÈ«Ñ¡µÄJS´úÂ룺
´úÂë
<script type="text/javascript" language="javascript">
function GetAllCheckBox(checkAll){
var items = document.getElementsByName("CheckBox2");
for(var i=0;i<items.length;i++){
&
Ïà¹ØÎĵµ£º
ASP.NET 2.0
Îļþ£±: Deafault.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&l ......
1. ´ò¿ªÐµĴ°¿Ú²¢´«ËͲÎÊý£º
¡¡¡¡´«ËͲÎÊý£º
response.write("£¼script£¾window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)£¼/script£¾")
¡¡¡¡½ÓÊÕ²ÎÊý£º
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
¡¡¡¡2.Ϊ°´Å¥Ìí¼Ó¶Ô»°¿ò
Button1 ......
“<%#....%>” ÕâÊÇÊý¾Ý°ó¶¨£¬ÀïÃæ¿ÉÒÔµ÷ÓÃC#µÄ·½·¨¡£
“<%$....%>" û¼û¹ýÕâ¸ö¡£
“<%@...%>”Õâ¸öÊÇÒ³ÃæÖ¸Áһ°ã·ÅÔÚÿ¸öÒ³ÃæµÄ×²¿£¬¶ÔÒ³ÃæµÄÔËÐнøÐпØÖÆ£¬ÈçÉèÖûº´æ£¬ÒýÓÃÓû§¿Ø¼þ£¬µ¼ÈëÃüÃû¿Õ¼ä==
ÁíÍ⻹ÓÐÒ»¸ö<%= ...%> Õâ¸ö=ºÅºóÒ²¿ÉÒÔµ÷ÓÃC#µÄ·½· ......
1. Êʵ±Ê¹ÓÃUpdatePanel
2. ÀûÓÃWebService·½·¨¶¯Ì¬Éú³ÉÓû§¿Ø¼þµÄÄÚÈÝ£¬±ÜÃâUpdatePanel»Ø´«Ôì³ÉµÄÐÔÄÜËðʧ£¨ViewState£©
3. ToolkitScriptManager´úÌæScriptManager
4. <asp:ScriptManager runat="server" ID="sm" ScriptMode="Release" EnablePartialRendering="false"
......