0% found this document useful (0 votes)
31 views

Code

The document provides code snippets and notes on various .NET topics including: 1. Allowing paging in a GridView and reloading the list data on page index changes 2. Setting the active view of a multi-view control and adding client-side confirmation to a delete button 3. Implementing try/catch blocks to handle exceptions 4. Creating and getting Membership users 5. Using LINQ to join tables and select specific fields to display in a GridView 6. No details provided for the last item

Uploaded by

hoahoctro071
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Code

The document provides code snippets and notes on various .NET topics including: 1. Allowing paging in a GridView and reloading the list data on page index changes 2. Setting the active view of a multi-view control and adding client-side confirmation to a delete button 3. Implementing try/catch blocks to handle exceptions 4. Creating and getting Membership users 5. Using LINQ to join tables and select specific fields to display in a GridView 6. No details provided for the last item

Uploaded by

hoahoctro071
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

GHI CHÚ CODE

1. Phân trang GridView


- AllowPaging = true
protected void gvBrands_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gvBrands.PageIndex = e.NewPageIndex;
LoadListBrands();
}

2. Code nhỏ
mvCategories.SetActiveView(vwEdit);
OnClientClick="return confirm('Are you sure you want to delete this item ?')"
ddlSubCategory.Items.Insert(0, new ListItem(null, null));

3. TryCatch
try
{

}
catch(Exception ex)
{
Response.Write(ex.Message);
}

4. Membership
a. Create
using System.Web.Security;

MembershipCreateStatus status;
MembershipUser member = Membership.CreateUser(txtUsername.Text, txtPassword.Text,
txtEmailAddress.Text, null, null,false, out status);
if (status == MembershipCreateStatus.Success){}

b. Get
5. LinQ
gvCategoryFields.DataSource = from cf in db.CategoryFields
join c in db.Categories on cf.CategoryID equals c.CategoryID
where cf.CategoryID == c.CategoryID
select new
{
cf.FieldID,
cf.CategoryID,
cf.MappingField,
cf.FieldName,
c.CategoryName
};

6.

You might also like