
default.aspx:


















<
SCRIPT
language
="JavaScript"
>
SCRIPT >
default.cs:
SCRIPT >
private
void
Page_Load(
object
sender, System.EventArgs e)
{
if ( ! this .IsPostBack)
{
this .down1_bind( " 0 " ); // 帮定国产车型
this .DropDownList1.Attributes.Add( " onchange " , " XmlPost2(this); " );
this .DropDownList2.Attributes.Add( " onchange " , " setchexing(); " );
}
if (carid != "" )
{
// 如果品牌不为空时,帮定车型
this .down2_bind(carid);
}
if (brandCountry != "" && brandCountry != " on " )
{
// 帮定国内或进口车型
this .down3_bind(brandCountry);
}
}
#region down2_bind
private void down2_bind( string id)
{
string mystr = "" ;
string sql = " select csmallid,classname from Base_ProdClass where cbigid=' " + id + " ' and NamePY is null order by classname " ;
DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.CONN_STRING,CommandType.Text,sql);
if (ds.Tables[ 0 ].Rows.Count != 0 )
{
for ( int i = 0 ;i < ds.Tables[ 0 ].Rows.Count;i ++ )
{
mystr += " , " + ds.Tables[ 0 ].Rows[i][ 0 ].ToString() + " | " + ds.Tables[ 0 ].Rows[i][ 1 ].ToString();
}
mystr = mystr.Substring( 1 );
}
this .Response.Write(mystr);
this .Response.End();
}
private void down22_bind( string id)
{
string mystr = "" ;
string sql = " select csmallid,classname from Base_ProdClass where cbigid=' " + id + " ' and NamePY is null order by classname " ;
DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.CONN_STRING,CommandType.Text,sql);
this .DropDownList2.DataValueField = " csmallid " ;
this .DropDownList2.DataTextField = " classname " ;
this .DropDownList2.DataBind();
DropDownList2.Items.Insert( 0 , new ListItem( " 选择系列.. " ,String.Empty));
DropDownList2.SelectedIndex = DropDownList2.Items.IndexOf(DropDownList2.Items.FindByValue( this .txtcx.Text));
}
#endregion
#region carid
private string carid
{
get
{
if (ViewState[ " carid " ] != null && ViewState[ " carid " ].ToString() != "" )
{
return ViewState[ " carid " ].ToString();
}
else
{
if (Request[ " carid " ] != null && Request[ " carid " ].ToString() != "" )
{
return Request[ " carid " ];
}
else
{
return "" ;
}
}
}
set
{
ViewState[ " carid " ] = value;
}
}
#endregion
#region brandCountry
private string brandCountry
{
get
{
if (ViewState[ " brandCountry " ] != null && ViewState[ " brandCountry " ].ToString() != "" )
{
return ViewState[ " brandCountry " ].ToString();
}
else
{
if (Request[ " brandCountry " ] != null && Request[ " brandCountry " ].ToString() != "" )
{
return Request[ " brandCountry " ];
}
else
{
return "" ;
}
}
}
set
{
ViewState[ " brandCountry " ] = value;
}
}
#endregion
#region down1_bind
private void down1_bind( string country)
{
DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.CONN_STRING,CommandType.Text, " select cbigid,classname from Base_ProdClass where NamePY=' " + country + " ' order by classname " );
this .DropDownList1.DataSource = ds;
this .DropDownList1.DataValueField = " cbigid " ;
this .DropDownList1.DataTextField = " classname " ;
this .DropDownList1.DataBind();
DropDownList1.Items.Insert( 0 , new ListItem( " 选择品牌.. " ,String.Empty));
DropDownList2.Items.Insert( 0 , new ListItem( " 选择系列.. " ,String.Empty));
}
private void down3_bind( string id)
{
string mystr = "" ;
string sql = " select cbigid,classname from Base_ProdClass where NamePY=' " + id + " ' order by classname " ;
DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.CONN_STRING,CommandType.Text,sql);
if (ds.Tables[ 0 ].Rows.Count != 0 )
{
for ( int i = 0 ;i < ds.Tables[ 0 ].Rows.Count;i ++ )
{
mystr += " , " + ds.Tables[ 0 ].Rows[i][ 0 ].ToString() + " | " + ds.Tables[ 0 ].Rows[i][ 1 ].ToString();
}
mystr = mystr.Substring( 1 );
}
this .Response.Write(mystr);
this .Response.End();
}
#endregion
{
if ( ! this .IsPostBack)
{
this .down1_bind( " 0 " ); // 帮定国产车型
this .DropDownList1.Attributes.Add( " onchange " , " XmlPost2(this); " );
this .DropDownList2.Attributes.Add( " onchange " , " setchexing(); " );
}
if (carid != "" )
{
// 如果品牌不为空时,帮定车型
this .down2_bind(carid);
}
if (brandCountry != "" && brandCountry != " on " )
{
// 帮定国内或进口车型
this .down3_bind(brandCountry);
}
}
#region down2_bind
private void down2_bind( string id)
{
string mystr = "" ;
string sql = " select csmallid,classname from Base_ProdClass where cbigid=' " + id + " ' and NamePY is null order by classname " ;
DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.CONN_STRING,CommandType.Text,sql);
if (ds.Tables[ 0 ].Rows.Count != 0 )
{
for ( int i = 0 ;i < ds.Tables[ 0 ].Rows.Count;i ++ )
{
mystr += " , " + ds.Tables[ 0 ].Rows[i][ 0 ].ToString() + " | " + ds.Tables[ 0 ].Rows[i][ 1 ].ToString();
}
mystr = mystr.Substring( 1 );
}
this .Response.Write(mystr);
this .Response.End();
}
private void down22_bind( string id)
{
string mystr = "" ;
string sql = " select csmallid,classname from Base_ProdClass where cbigid=' " + id + " ' and NamePY is null order by classname " ;
DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.CONN_STRING,CommandType.Text,sql);
this .DropDownList2.DataValueField = " csmallid " ;
this .DropDownList2.DataTextField = " classname " ;
this .DropDownList2.DataBind();
DropDownList2.Items.Insert( 0 , new ListItem( " 选择系列.. " ,String.Empty));
DropDownList2.SelectedIndex = DropDownList2.Items.IndexOf(DropDownList2.Items.FindByValue( this .txtcx.Text));
}
#endregion
#region carid
private string carid
{
get
{
if (ViewState[ " carid " ] != null && ViewState[ " carid " ].ToString() != "" )
{
return ViewState[ " carid " ].ToString();
}
else
{
if (Request[ " carid " ] != null && Request[ " carid " ].ToString() != "" )
{
return Request[ " carid " ];
}
else
{
return "" ;
}
}
}
set
{
ViewState[ " carid " ] = value;
}
}
#endregion
#region brandCountry
private string brandCountry
{
get
{
if (ViewState[ " brandCountry " ] != null && ViewState[ " brandCountry " ].ToString() != "" )
{
return ViewState[ " brandCountry " ].ToString();
}
else
{
if (Request[ " brandCountry " ] != null && Request[ " brandCountry " ].ToString() != "" )
{
return Request[ " brandCountry " ];
}
else
{
return "" ;
}
}
}
set
{
ViewState[ " brandCountry " ] = value;
}
}
#endregion
#region down1_bind
private void down1_bind( string country)
{
DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.CONN_STRING,CommandType.Text, " select cbigid,classname from Base_ProdClass where NamePY=' " + country + " ' order by classname " );
this .DropDownList1.DataSource = ds;
this .DropDownList1.DataValueField = " cbigid " ;
this .DropDownList1.DataTextField = " classname " ;
this .DropDownList1.DataBind();
DropDownList1.Items.Insert( 0 , new ListItem( " 选择品牌.. " ,String.Empty));
DropDownList2.Items.Insert( 0 , new ListItem( " 选择系列.. " ,String.Empty));
}
private void down3_bind( string id)
{
string mystr = "" ;
string sql = " select cbigid,classname from Base_ProdClass where NamePY=' " + id + " ' order by classname " ;
DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.CONN_STRING,CommandType.Text,sql);
if (ds.Tables[ 0 ].Rows.Count != 0 )
{
for ( int i = 0 ;i < ds.Tables[ 0 ].Rows.Count;i ++ )
{
mystr += " , " + ds.Tables[ 0 ].Rows[i][ 0 ].ToString() + " | " + ds.Tables[ 0 ].Rows[i][ 1 ].ToString();
}
mystr = mystr.Substring( 1 );
}
this .Response.Write(mystr);
this .Response.End();
}
#endregion
sql:
CREATE
TABLE
[
dbo
]
.
[
Base_ProdClass
]
(
[ CBigID ] [ varchar ] ( 4 ) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[ CSmallID ] [ varchar ] ( 2 ) COLLATE Chinese_PRC_CI_AS NULL ,
[ ClassName ] [ varchar ] ( 50 ) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[ NamePY ] [ varchar ] ( 50 ) COLLATE Chinese_PRC_CI_AS NULL
) ON [ PRIMARY ]
GO
[ CBigID ] [ varchar ] ( 4 ) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[ CSmallID ] [ varchar ] ( 2 ) COLLATE Chinese_PRC_CI_AS NULL ,
[ ClassName ] [ varchar ] ( 50 ) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[ NamePY ] [ varchar ] ( 50 ) COLLATE Chinese_PRC_CI_AS NULL
) ON [ PRIMARY ]
GO
数据库下载,此车型库为11月29日更新