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;
Namespace localhost. template background management
{
///
<Summary>
/// Summary of skinmanage.
/// </Summary>
Public
Class skinmanage: system. Web. UI. Page
{
Protected
System. Web. UI. webcontrols. Button btnselectall;
Protected
System. Web. UI. webcontrols. Button btndel;
Protected
System. Web. UI. webcontrols. Button btnsubmit;
Protected
System. Web. UI. webcontrols. checkbox checkboxselectall;
Protected
System. Web. UI. webcontrols. DataGrid datagrid2;
Protected bool
Selected = false;
Private void page_load (Object sender, system. eventargs
E)
{
// Place the user here Code To initialize the page
// Place user code here to initialize the page
Sqlconnection
Conn;
Conn = new
Sqlconnection ("Server = localhost; database = skin; uid = sa; Pwd = ''");
Conn. open ();
Sqldataadapter
DA = new sqldataadapter ("select ID, skin_name from skinbin", Conn );
Dataset
DS = new
Dataset ();
Da. Fill (DS, "skin ");
Da. Fill (DS, "skinall ");
// Show_string = Ds. Tables ["skin"]. Rows [0] [0]. tostring ();
Datagrid2.datasource = Ds. Tables ["skinall"]. defaultview;
Datagrid2.databind ();
}
# Code generated by region web Form Designer
Override protected void oninit (eventargs
E)
{
//
// Codegen: This call is ASP. NET web
Required by the Form Designer.
//
Initializecomponent ();
Base. oninit (E );
}
///
<Summary>
/// The designer supports the required methods-do not use the code editor to modify
/// Content of this method.
///
</Summary>
Private void initializecomponent ()
{
This. Maid + = new
System. Web. UI. webcontrols. datagridcommandeventhandler (this. datagrid2_deletecommand );
This. btnselectall. Click
+ = New
System. eventhandler (this. btnselectall_click );
This. checkboxselectall. checkedchanged
+ = New
System. eventhandler (this. checkboxselectall_checkedchanged );
This. Load + =
New system. eventhandler (this. page_load );
}
# Endregion
Private void datagrid2_deletecommand (Object source,
System. Web. UI. webcontrols. datagridcommandeventargs
E)
{
Try
{
Sqlconnection conn;
Conn = new
Sqlconnection ("Server = localhost; database = skin; uid = sa; Pwd = ''");
Conn. open ();
String
Id = "";
Id = E. Item. cells [2]. text;
Sqlcommand comm = new
Sqlcommand ("Update skinbin set isdefault = 1 where
Id = "+ id, Conn );
Comm. executenonquery ();
}
Catch
{
}
Response. Write ("<SCRIPT> alert ('template changed, please refer to user interface'); </SCRIPT> ");
}
Private void btnselectall_click (Object sender, system. eventargs
E)
{
// For (INT I = 0; I <gridview1.rows. count;
I ++) // starts from the first row and ends, and updates all scores at a time.
//{
// Gridviewrow ROW =
Gridview1.rows [I]; // defines grideviewrow
// C. Score
= Convert. todecimal (textbox) Row. cells [0]. findcontrol ("textbox1"). Text); // convert the string entered in textbox1 to the decimal type
// C. course No.
= Gridview1.datakeys [I]. Values [0]. tostring ();
// C. Student ID =
Gridview1.datakeys [I]. Values [1]. tostring ();
// If
(Chafenbolactions. updatescore (c) = 1)
// {Label1.text = "updated successfully ";
}
// Else
//{
// Break; // update failed, jump out
//}
//
//}
Int Ct = 0;
If (ispostback)
{
Bool
B;
Arraylist AR = new arraylist ();
For (int
I = 0; I <maid. Count; I ++)
{
B = (checkbox) maid [I]. findcontrol ("checkboxselect"). checked;
If
(B)
{
CT ++;
}
}
}
Response. Write (CT );
}
Private void checkboxselectall_checkedchanged (Object sender,
System. eventargs E)
{
// Selected =! Selected;
For (int
I = 0; I <maid. Count; I ++)
{
(Checkbox) maid [I]. findcontrol ("checkboxselect"). Checked =
Checkboxselectall. checked;
}
}
}
}