using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Web.Configuration;
public partial class _Default : System.Web.UI.Page
{
Class1 c = new Class1();
DataSet ds = new DataSet();
protected void Page_Load(object sender, EventArgs e)
{
try
{
string sid = Request.QueryString[""].ToString();
string type = Request.QueryString[""].ToString();
SqlConnection cn = new SqlConnection(c.connectionString);
SqlCommand cmd = new SqlCommand("dbo.usp_get_blog_info", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@sid", sid);
cmd.Parameters.AddWithValue("@type", type);
SqlDataAdapter da = new SqlDataAdapter();
DataSet ds = new DataSet();
da.Fill(ds);
}
catch
{
SqlConnection cn = new SqlConnection(c.connectionString);
SqlCommand cmd = new SqlCommand("dbo.usp_get_blog_info", cn);
cmd.CommandType = CommandType.StoredProcedure;
//cmd.Parameters.Add(new SqlParameter("@sid","10000"));
// cmd.Parameters.Add(new SqlParameter("type", "NULL"));
cmd.Parameters.AddWithValue("@sid", "100000");
cmd.Parameters.AddWithValue("@type", "NULL");
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
FormView1.DataSource = ds;
FormView1.DataBind();
Label l=(Label)FormView1.FindControl("Header");
l.Text =ds.Tables[0].Rows[0]["header"].ToString();
TextBox l1=(TextBox)FormView1.FindControl("Label1");
l1.Text =ds.Tables[0].Rows[0]["matter"].ToString();
}
}
protected void FormView1_PageIndexChanging(object sender, FormViewPageEventArgs e)
{
FormView1.PageIndex = e.NewPageIndex;
int i = e.NewPageIndex;
SqlConnection cn = new SqlConnection(c.connectionString);
SqlCommand cmd = new SqlCommand("dbo.usp_get_blog_info", cn);
cmd.CommandType = CommandType.StoredProcedure;
//cmd.Parameters.Add(new SqlParameter("@sid","10000"));
// cmd.Parameters.Add(new SqlParameter("type", "NULL"));
cmd.Parameters.AddWithValue("@sid", "100000");
cmd.Parameters.AddWithValue("@type", "NULL");
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds1 = new DataSet();
da.Fill(ds1);
FormView1.DataSource = ds;
FormView1.DataBind();
//this new lable l initialize the header label in formview;
Label l = (Label)FormView1.FindControl("Header");
l.Text = ds1.Tables[0].Rows[i]["header"].ToString();
TextBox l1 = (TextBox)FormView1.FindControl("Label1");
l1.Text = ds1.Tables[0].Rows[i]["matter"].ToString();
//FormView1.DataBind();
}
protected void Label1_TextChanged(object sender, EventArgs e)
{
}
}
This is a open code forum with some good code which makes you help to solve your coding problem.
Monday, January 10, 2011
Subscribe to:
Post Comments (Atom)
SQL Optimization
SQL Optimization 1. Add where on your query 2. If you remove some data after the data return then remove the remove condition in the sel...
-
Kendo UI Uploader : Create a kendo ui uploader control in MVC View @( Html.Kendo().Upload() .Name( "fi...
-
string float_value="234.4567"; //If data come from databse then first convert it into string then this line; float fl=float.pars...
-
We are bind dynamic columns and there values as a rows to Kendo UI grid, To do this we are using a Json file as a data and column list. ...
1 comment:
Bhalo ,, But Store Procedure taa ke dabe ...
Post a Comment