ASP.NETµÄʵÓôúÂë
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.Attributes.Add("onclick","return confirm(’È·ÈÏ?’)");
button.attributes.add("onclick","if(confirm(’are you sure...?’)){return true;}else{return false;}")
3.ɾ³ý±í¸ñÑ¡¶¨¼Ç¼
int intEmpID = (int)MyDataGrid.DataKeys[e.Item.ItemIndex];
string deleteCmd = "DELETE from Employee where emp_id = " + intEmpID.ToString()
4.ɾ³ý±í¸ñ¼Ç¼¾¯¸æ
private void DataGrid_ItemCreated(Object sender,DataGridItemEventArgs e)
{
¡¡switch(e.Item.ItemType)
¡¡{
case ListItemType.Item :
case ListItemType.AlternatingItem :
case ListItemType.EditItem:
¡¡TableCell myTableCell;
¡¡myTableCell = e.Item.Cells[14];
¡¡LinkButton myDeleteButton ;
¡¡myDeleteButton = (LinkButton)myTableCell.Controls[0];
¡¡myDeleteButton.Attributes.Add("onclick","return confirm(’ÄúÊÇ·ñÈ·¶¨ÒªÉ¾³ýÕâÌõÐÅÏ¢’);");
¡¡break;
default:
¡¡break;
¡¡}
}
5.µã»÷±í¸ñÐÐÁ´½ÓÁíÒ»Ò³
private void grdCustomer_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
¡¡//µã»÷±í¸ñ´ò¿ª
¡¡if (e.Item.ItemType == ListItemType.Item e.Item.ItemType == ListItemType.AlternatingItem)
e.Item.Attributes.Add("onclick","window.open(’Default.aspx?id=" + e.Item.Cells[0].Text + "’);");
}
Ë«»÷±í¸ñÁ¬½Óµ½ÁíÒ»Ò³
ÔÚitemDataBindʼþÖÐ
if(e.Item.ItemType == ListItemType.Item e.Item.ItemType == ListItemType.AlternatingItem)
{
¡¡string OrderItemID =e.item.cells[1].Text;
¡¡...
¡¡e.item.Attributes.Add("ondblclick", "location.href=’../ShippedGrid.aspx?id=" + OrderItemID + "&rsq
Ïà¹ØÎĵµ£º
²½Ö裺
1¡¢ÏÈÔÚDÅ̽¨Ò»¸öÐÂÎļþ¼Ð
2¡¢´ò¿ªVS2008£¬Ð½¨Ò»¸öÍøÕ¾£¬¸ü¸ÄÃû×Öºó´æ·ÅÔÚ1ÖеÄÎļþ¼ÐÖУ¬´ËʱҪ¼ÇµÃ¸ø¸ÃÍøÕ¾½¨Ò»¸öеÄÎļþ¼Ð£¬×¨ÃÅÓÃÀ´´æ·Å¸ÃÍøÕ¾ËùÓеÄÎļþ£»
3¡¢´î½¨Êý¾Ý·ÃÎʲ㣬µã»÷Îļþ——Ìí¼Ó——н¨ÏîÄ¿——Àà¿â£¬¸ü¸ÄÃû×ÖÖ®ºó£¬´æ·ÅÔÚ1ÖеÄÎļþ¼ÐÖУ¬Í¬ÑùҲΪÊý ......
ʾÀý
µÚÒ»¸öʾÀýÑÝʾÈçºÎ´´½¨ FileUpload ¿Ø¼þ£¬¸Ã¿Ø¼þ½«Îļþ±£´æµ½´úÂëÖÐÖ¸¶¨µÄ·¾¶¡£
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
  ......
javascript º¯Êý ºÍ CustomValidator¿Ø¼þÏà½áºÏʹÓÃ
<asp:TextBox ID="txtPwdPrompt" runat="server"></asp:TextBox>
<asp:CustomValidator id="CVPwdPrompt" runat="server" ClientValidationFunction="CheckPwd" ControlToValidate="txtPwdPrompt" ErrorMessage="<span style='font:12px'>ÌáʾÎÊÌ ......
±¾Îĺʹó¼Ò·ÖÏíµÄÊÇ.NETÖд°ÌåµÄÆ®¶¯¡£Ï£Íû¶Ô´ó¼ÒÓÐËù°ïÖú°É¡£
ÓÃ.NETÖÆ×÷Æ®¶¯µÄ´°Ìåʱ£¬ÐèҪʹÓÃTimer¿Ø¼þ¡£Ê×ÏÈ£¬µ±´°Ìå¼ÓÔØʱÉ趨һ¸ö³õʼλÖã¬È»ºóÔÚ´°ÌåÖж¨ÒåÁ½¸öTimer¿Ø¼þ£¬ÆäÖÐtimer1ÓÃÀ´¿ØÖÆ´°Ìå´Ó×óÏòÓÒÆ®¶¯£¬timer2¿ØÖÆ´°Ìå´ÓÓÒÏò×óÆ®¶¯£¬µ±timer1Æô¶¯ºó£¬Ã¿¸ô0.01s£¬¶¼»áÔÚ´¥·¢µÄʼþÖиø ......