Sql

Saturday, December 24, 2011

Use of Link Label in Grid View

In aspx.cs page...


public partial class Default2 : System.Web.UI.Page
{
DataTable dt;
SqlConnection cnn;
SqlDataAdapter adp;
protected void Page_Load(object sender, EventArgs e)
{

cnn = new SqlConnection("Data Source=.;Initial Catalog=rd;Integrated Security=True");
cnn.Open();
if (cnn.State == ConnectionState.Closed)
{
cnn.Open();
}
if (Page.IsPostBack == false)
{

grd_bind();
}
}


private void grd_bind()
{
( case when website='' then 'NA'else 'View Site' end ) as school_website,
website from school", cnn);

dt = new DataTable();
adp.Fill(dt);
adp.Dispose();

if (dt.Rows.Count == 0)
{

GridView1.Visible = false;

}
else
{
GridView1.Visible = true;
GridView1.DataSource = dt;
GridView1.DataBind();
Int32 i;
for (i = 0; i <= dt.Rows.Count - 1; i++)
{
String website = (dt.Rows[i]["school_website"].ToString());

if (website == "View Site")
{
((Label)GridView1.Rows[i].FindControl("lbl_website")).Text = "" + dt.Rows[i]["school_website"].ToString() + "";
}
else if (website == "NA")
{
((Label)GridView1.Rows[i].FindControl("lbl_website")).Text = dt.Rows[i]["school_website"].ToString();
}
}
}
}
}

In aspx page























Wednesday, December 21, 2011

IT Solution: How To make a DVD writer in Asp.net

IT Solution: How To make a DVD writer in ASP.net

What is .NET?

  • It is a platform neutral framework.
  • It is a layer between the operating system and the programming language.
  • It supports many programming languages, including VB.NET, C# etc.
  • .NET provides a common set of class libraries, which can be accessed from any .NET based programming language. There will not be separate set of classes and libraries for each language. If you know any one .NET language, you can write code in any .NET language!!
  • In future versions of Windows, .NET will be freely distributed as part of operating system and users will never have to install .NET separately.