1

Fileupload in edit template of Gridview

Code Behind File: protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if(GridView1.EditIndex == -1) return; FileUpload fileUpLoad = GridView1.Rows[GridView1.EditIndex].FindControl("FileUpload1")...
0

Sitemap - Hiding Login/Logout etc

The following code shows to hide "Login" if users are already logged in and hide "Logout" if users are not logged in from the menu.1 protected void Menu1_DataBound(object sender, EventArgs e)2 {3...
0

Get the control out from the templatefield of Detailsview

The following codes are the examples to get the control out from the templatefield of Detailsview:TextBox UserNameBox = DetailsView1.FindControl("UserName") as TextBox;Label ErrorLabel = DetailsView1.FindControl("ErrorLabel")...
0

Check for duplicate records before executing INSERT

The following code may handle the exception when insert the duplicate recordsprotected void SqlDataSource1_Inserted(object sender, SqlDataSourceStatusEventArgs e){ if (e.Exception != null) ...
0

Use the GridView to insert a new record

This...