Click here to Skip to main content
15,885,546 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: total and subtotal in gridview footer Pin
Nishant Singh9-Nov-09 1:13
Nishant Singh9-Nov-09 1:13 
GeneralRe: total and subtotal in gridview footer Pin
RajpootRohan9-Nov-09 1:19
professionalRajpootRohan9-Nov-09 1:19 
QuestionUnable to host WCF service in IIS7 Pin
cranialsurge8-Nov-09 22:22
cranialsurge8-Nov-09 22:22 
AnswerRe: Unable to host WCF service in IIS7 Pin
Gamzun8-Nov-09 23:43
Gamzun8-Nov-09 23:43 
Questionfileupload postback Pin
m@dhu8-Nov-09 21:35
m@dhu8-Nov-09 21:35 
AnswerRe: fileupload postback Pin
Gamzun8-Nov-09 21:39
Gamzun8-Nov-09 21:39 
GeneralRe: fileupload postback Pin
m@dhu8-Nov-09 21:49
m@dhu8-Nov-09 21:49 
GeneralRe: fileupload postback Pin
Gamzun8-Nov-09 21:56
Gamzun8-Nov-09 21:56 
QuestionCould not load type 'Andri.Web.MySqlMembershipProvider' Pin
nebitesh8-Nov-09 20:16
nebitesh8-Nov-09 20:16 
AnswerRe: Could not load type 'Andri.Web.MySqlMembershipProvider' Pin
Abhishek Sur8-Nov-09 21:08
professionalAbhishek Sur8-Nov-09 21:08 
GeneralRe: Could not load type 'Andri.Web.MySqlMembershipProvider' Pin
nebitesh9-Nov-09 1:37
nebitesh9-Nov-09 1:37 
AnswerRe: Could not load type 'Andri.Web.MySqlMembershipProvider' Pin
Gamzun8-Nov-09 22:08
Gamzun8-Nov-09 22:08 
Questionset dropdownbox value which affect on other dropdown Pin
KIDYA8-Nov-09 20:00
KIDYA8-Nov-09 20:00 
AnswerRe: set dropdownbox value which affect on other dropdown Pin
Gamzun8-Nov-09 20:14
Gamzun8-Nov-09 20:14 
GeneralRe: set dropdownbox value which affect on other dropdown Pin
KIDYA8-Nov-09 20:42
KIDYA8-Nov-09 20:42 
GeneralRe: set dropdownbox value which affect on other dropdown Pin
Gamzun8-Nov-09 20:47
Gamzun8-Nov-09 20:47 
AnswerRe: set dropdownbox value which affect on other dropdown Pin
deepseeindeepsy8-Nov-09 20:25
deepseeindeepsy8-Nov-09 20:25 
GeneralRe: set dropdownbox value which affect on other dropdown Pin
KIDYA8-Nov-09 20:39
KIDYA8-Nov-09 20:39 
GeneralRe: set dropdownbox value which affect on other dropdown Pin
deepseeindeepsy8-Nov-09 20:46
deepseeindeepsy8-Nov-09 20:46 
GeneralRe: set dropdownbox value which affect on other dropdown Pin
KIDYA8-Nov-09 20:55
KIDYA8-Nov-09 20:55 
GeneralRe: set dropdownbox value which affect on other dropdown Pin
deepseeindeepsy8-Nov-09 21:31
deepseeindeepsy8-Nov-09 21:31 
AnswerRe: set dropdownbox value which affect on other dropdown Pin
Nishant Singh8-Nov-09 23:25
Nishant Singh8-Nov-09 23:25 
AnswerRe: set dropdownbox value which affect on other dropdown Pin
April Fans9-Nov-09 21:20
April Fans9-Nov-09 21:20 
namespace WebApplicationDlh
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using Db;
/// <summary>
/// Area
/// </summary>
public class Area : System.Web.UI.UserControl
{
protected System.Web.UI.WebControls.DropDownList ddlProvince;
protected System.Web.UI.WebControls.DropDownList ddlCity;
public string strProvince
{
get
{
return ddlProvince.SelectedItem.Value;
}
set
{
ddlProvince.SelectedItem.Value = value;
}
}
public string strCity
{
get
{
return ddlCity.SelectedItem.Value;
}
set
{
ddlCity.SelectedItem.Value = value;
}
}
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
ddlProvinceBind();
ddlCity.Items.Insert(0,"-City to choose-");
}
}
private void ddlProvinceBind()
{
Db.Area myArea = new Db.Area();
SqlDataReader dr = myArea.GetAllProvince();
if(dr.Read())
{
ddlProvince.DataSource = dr;
ddlProvince.DataTextField = "Province";
ddlProvince.DataValueField = "Province";
ddlProvince.DataBind();
ddlProvince.Items.Insert(0,"-Province to choose-");
}
}
#region Web
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
///
///
/// </summary>
private void InitializeComponent()
{
this.ddlProvince.SelectedIndexChanged += new System.EventHandler(this.ddlProvince_SelectedIndexChanged);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void ddlProvince_SelectedIndexChanged(object sender, System.EventArgs e)
{
if(ddlProvince.SelectedItem.Value == "-Province to choose-")
{
ddlCity.Items.Clear();
ddlCity.Items.Insert(ddlProvince.SelectedIndex,"-City to choose-");
}
else
{
Db.Area myArea = new Db.Area();
SqlDataReader dr = myArea.GetAllCityWhereProvince(ddlProvince.SelectedItem.Value);
if(dr.Read())
{
ddlCity.DataSource = dr;
ddlCity.DataTextField = "City";
ddlCity.DataValueField = "ID";
ddlCity.DataBind();
}
}
}
}
}

=============================================================〉
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
namespace Db
{
/// <summary>
/// Area
/// </summary>
public class Area:Base
{
public Area()
{
//
// TODO:
//
}
public SqlDataReader GetAllProvince()
{
strSp = "Sp_Area_SelectAll";
drSelectAll(strSp);
return dr;
}
public SqlDataReader GetAllCityWhereProvince(string a)
{
conn = new SqlConnection(ConfigurationSettings.AppSettings["dsn"]);
cmd = new SqlCommand("Sp_Area_SelectAllWhereProvince",conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@Province",SqlDbType.VarChar,50).Value = a.ToString();
conn.Open();
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
return dr;
}
}
}

=====================================================〉
if exists (select * from dbo.sysobjects where id = object_id(N’[dbo].[Sp_Area_SelectAll]’) and OBJECTPROPERTY(id, N’IsProcedure’) = 1)
drop procedure [dbo].[Sp_Area_SelectAll]
GO
if exists (select * from dbo.sysobjects where id = object_id(N’[dbo].[Sp_Area_SelectAllWhereProvince]’) and OBJECTPROPERTY(id, N’IsProcedure’) = 1)
drop procedure [dbo].[Sp_Area_SelectAllWhereProvince]
GO
if exists (select * from dbo.sysobjects where id = object_id(N’[dbo].[Area]’) and OBJECTPROPERTY(id, N’IsUserTable’) = 1)
drop table [dbo].[Area]
GO
CREATE TABLE [dbo].[Area] (
[ID] [int] NOT NULL ,
[Province] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[City] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[其它] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY]
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE Sp_Area_SelectAll
AS
SELECT DISTINCT Province
FROM Area
ORDER BY Province
RETURN
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE Sp_Area_SelectAllWhereProvince
@Province varchar(50)
AS
SELECT Area.*
FROM Area
WHERE (Province = @Province)
RETURN
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
================================================〉
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration; namespace Db
{
/// <summary>
/// Base
/// </summary>
public class Base
{
public Base()
{
//
// TODO:
//
}
protected string con = ConfigurationSettings.AppSettings["dsn"];
protected SqlConnection conn;
protected SqlCommand cmd;
protected SqlDataReader dr;
protected string strSp;
protected SqlDataReader drSelectAll(string strSp)
{
conn = new SqlConnection(con);
cmd = new SqlCommand(strSp,conn);
cmd.CommandType = CommandType.StoredProcedure; conn.Open();
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
return dr;
}//SqlDataReader }
}
April

Comm100 - Leading Live Chat Software Provider


modified 27-May-14 21:55pm.

QuestionPDF File Not Read see my code. Pin
lrsalunkhe8-Nov-09 19:50
lrsalunkhe8-Nov-09 19:50 
AnswerRe: PDF File Not Read see my code. Pin
Gamzun8-Nov-09 20:17
Gamzun8-Nov-09 20:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.