Thulasiram pakala

Thulasiram pakala

  • 900
  • 872
  • 116.6k

Inside name space page load event not fired

Apr 28 2016 6:14 AM
I am using this code but in this page load event is now fired
 
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Web.Configuration;
using System.Web.UI.WebControls.TextBox;
using System.Web.UI.WebControls.Label;
using System.Web.UI.WebControls.DropDownList;
using System.Web.UI.WebControls.RequiredFieldValidator;
using System.Web.UI.WebControls.Button ;
using System.Web.SessionState.HttpSessionState;
namespace SimpleChat
{
/// <summary>
/// Summary description for _Default.
/// </summary>
public partial class _Default : System.Web.UI.Page
{
SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["ekrishi"].ConnectionString);
// SqlConnection =new SqlConnection(WebConfigurationManager.ConnectionStrings["ekrishi"].ConnectionString);
protected System.Web.UI.WebControls.TextBox TB_Channel;
protected System.Web.UI.WebControls.TextBox TB_usename;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.TextBox TB_Pwd;
protected System.Web.UI.WebControls.DropDownList Ddlgrp;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
protected System.Web.UI.WebControls.Button BT_Enter;
protected System.Web.SessionState.HttpSessionState Session;
public void Page_Load(object sender, System.EventArgs e)
{
TB_Channel.Text=Ddlgrp.SelectedValue.ToString();
con.Open();
SqlCommand ddlgpbnd=new SqlCommand("Select Group_ID,Group_Name From Chatt_Group" ,con);
SqlDataAdapter gpda=new SqlDataAdapter(ddlgpbnd);
DataSet gpds=new DataSet();
gpda.Fill(gpds);
con.Close();
Ddlgrp.DataSource = gpds;
Ddlgrp.DataTextField = "Group_Name";
Ddlgrp.DataValueField = "Group_ID";
Ddlgrp.DataBind();
Ddlgrp.Items.Insert(0, new ListItem("--Please select Group--", "0"));
Session["uname"] = TB_Channel.Text;
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.BT_Enter.Click += new System.EventHandler(this.BT_Enter_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void BT_Enter_Click(object sender, System.EventArgs e)
{
Response.Redirect("ChatWin.aspx?Username=" + TB_Channel.Text + "&Userid=" + TB_usename.Text + "&Password=" + TB_Pwd.Text);
}
}
}
can any one tell what problem in this i change Autoeventewirup true but its not working 

Answers (3)