| TechTasks.net |
The Blog is Moved to www.TechTasks.net
In .CS file
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
SqlConnection con; SqlDataAdapter da; SqlCommand cmd; DataSet ds;
protected void Page_Load(object sender, EventArgs e)
{
con = new SqlConnection("server=FOCALPOI-392A7D\\SQLEXPRESS;user id=raji;password=chekuri;database=raji");
con.Open();
da = new SqlDataAdapter("select * from product", con);
ds = new DataSet();
da.Fill(ds, "product");
GridView1.DataSource = ds;
GridView1.DataBind();
}
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
string onmouseoverstyle = "this.style.backgroundColor='red'";
string onmouseoutstyle="this.style.backgroundColor = 'white'";
string onmouseclickstyle = "this.style.backgroundColor = 'lightgreen'";
if (e.Row.RowType == DataControlRowType.DataRow)
{
//adds events to GridView row
e.Row.Attributes.Add("onmouseover", onmouseoverstyle);
e.Row.Attributes.Add("onmouseout", onmouseoutstyle);
e.Row.Attributes.Add("onclick", onmouseclickstyle );
}
}
}
DESIGN
Blog Archive
-
▼
2008
(33)
-
▼
December
(14)
- Non Editable Rows in GridView
- Validate DropDownList inside GRIDVIEW
- .Net Keyboard Shortcuts
- Grid View Operataions
- FAQ'S & INTERVIEW TIPS
- C#.NET
- ASP.NET
- DOTNET FRAMEWORK
- Projects With Source Code
- Enter Text In Into Two TextBoxes At the Same Time
- Saving Uploaded file into Disk and displaying the ...
- Writing Connection string in web.config file
- Change GridView Row Color When MouseOver
- Working With Command Builder in ASP.NET
-
►
November
(14)
- JavaScript Validatoin For Basic Controles in ASP.N...
- Dot Net - C#.Net(FAQ'S)
- Dot Net - Asp.Net - Basic II(FAQ'S)
- Dot Net - Asp.Net - Basic I(FAQ'S)
- Famous Books For .NET
- Connecting MySql With Asp.net Using ODBC Drivers
- Simple Calculator In Windows Application Using C#
- Mail Sending Using Net.Mail
- Select All And Delete Using CheckBox In GridView
- GridView DeleteAll,SelectAll,ClearAll(Server Side)...
- GridView Paging & Sorting
- GridView Update,Delete,Adding (Insert) Record...
- Alphabetical Paging in Gridview
- Connecting MySql With C# ASP.NET
-
▼
December
(14)


0 comments: