Some of the information collected in the Forum collection when beginners asp.net

Source: Internet
Author: User
1. Open a new window and transfer parameters:
Transfer parameters:
Response.Write ("<script>window.open" (' *.aspx?id= ') +this. dropdownlist1.selectindex+ "&id1=" +...+ "') </script>")
Receive parameters:
String a = Request.QueryString ("id");
String B = Request.QueryString ("Id1");
2. Add a dialog box for the button
BUTTON1.ATTRIBUTES.ADD ("onclick", "return confirm (' Confirm? ')");
Button.attributes.add ("onclick", "If" (Confirm (' Are you sure ...? ')) {return true;} Else{return false;} ")
3. Delete table Selected records
int intempid = (int) Mydatagrid.datakeys[e.item.itemindex];
String deletecmd = "DELETE from Employee where emp_id =" + intempid.tostring ()
4. Delete the form record warning
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" (' You are sure you want to delete this message '); ");
Break
Default
Break
}
}
5. Click on a table row link another page
private void Grdcustomer_itemdatabound (object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)

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.