What is the difference between Server.Transfer and
Response.Redirect? Why would you choose one over the other?

Answer Posted / x

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
public SqlDataAdapter dap = null;
public DataSet dst = null;
public string projDesc = string.Empty;
public string divisionName = string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection();
con.ConnectionString =
ConfigurationManager.ConnectionStrings["conString"].ToString
();
con.Open();
string sql = string.Empty;
string projCode = string.Empty;
string divisionCode = string.Empty;

if (!IsPostBack)
{
dap = new SqlDataAdapter("select * from
Project", con);
dst = new DataSet();
dap.Fill(dst);
ddlProject.DataSource = dst;
ddlProject.DataValueField = dst.Tables
[0].Columns["ProjCode"].ToString();
ddlProject.DataTextField = dst.Tables[0].Columns
["ProjDesc"].ToString();
ddlProject.DataBind();
dap.Dispose();
dst.Dispose();
}
projCode = ddlProject.SelectedValue.ToString();
if (Session["projCode"] == null || !projCode.Equals
(Session["projCode"].ToString()))
{
sql = "select * from Division where ProjCode
= " + Convert.ToInt32(projCode);
dap = new SqlDataAdapter(sql, con);
dst = new DataSet();
dap.Fill(dst);
ddlDivision.DataSource = dst;
ddlDivision.DataValueField = dst.Tables
[0].Columns["DivisionID"].ToString();
ddlDivision.DataTextField = dst.Tables
[0].Columns["DivisionName"].ToString();
ddlDivision.DataBind();
dap.Dispose();
dst.Dispose();
Session["projCode"] = projCode;
}
divisionCode = ddlDivision.SelectedValue.ToString();
if (!divisionCode.Equals(string.Empty))
{
sql = "select a.ProjDesc, b.DivisionName,
c.MemberName from Project a inner join Division b on
a.ProjCode = b.ProjCode ";
sql += "inner join Member c on b.DivisionID =
c.DivisionID where a.ProjCode = " + Convert.ToInt32
(projCode);
sql += " and b.DivisionID = " + Convert.ToInt32
(divisionCode);
dap = new SqlDataAdapter(sql, con);
dst = new DataSet();
dap.Fill(dst);
gvProj.DataSource = dst;
gvProj.DataBind();
dap.Dispose();
dst.Dispose();
}
con.Close();
}

protected void gvProj_RowDataBound(object sender,
GridViewRowEventArgs e)
{
gvRowCheck(e);
}
private void gvRowCheck(GridViewRowEventArgs e)
{
if (e.Row.RowIndex == 0)
{
projDesc = e.Row.Cells[0].Text;
divisionName = e.Row.Cells[1].Text;
}
if (e.Row.RowIndex > 0)
{
if (projDesc.Equals(e.Row.Cells[0].Text))
{
e.Row.Cells[0].Text = "";
}
if (divisionName.Equals(e.Row.Cells[1].Text))
{
e.Row.Cells[1].Text = "";
}
}
}

}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a web api endpoint?

618


Define common type system?

659


By default, Web API sends HTTP response with which of the following status code for all uncaught exception?

1111


What is .net remoting?

673


What is the extension of master page in asp.net?

653






What is asp.net with mvc? : Asp.Net MVC

611


Where is the view state data stored?

661


What is the difference between sealed vs static class?

660


benefits of migration from asp to asp.net hi frnds, i have to give presentation to a client about how useful would be migrating their project from asp to asp.net .plz give me some points which i should incorporate in my ppt thanks

1738


Can you dynamically assign a Master Page?

666


Explain the page lifecycle of an asp.net mvc? : asp.net mvc

500


What are sharepoint pages?

572


What do you mean by marshalbyref?

736


Will the asp.net validators run in server side or client side? How do you do client-side validation in .net? How to disable validator control by client side javascript?

624


Define page fragment caching?

601