Asp.net--slider controls

Source: Internet
Author: User

The. aspx code is as follows:

<%@ page language= "C #" autoeventwireup= "true" codefile= "Slider_ synthetic instance. Aspx.cs" inherits= "LESSON_CODE_DEFAULT2"% >


<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">


<title></title>
<style type = "Text/css" >
#div_nav {width:200px;}
#div_content {width:500px;
margin-left:20px;
padding:10px; }

. myhandle {width:10px; height:10px;
margin-top:10px; }
. myrail {width:500px; height:10px;
Background-image:url (".. /img/rail_pm.png "); Background-repeat:no-repeat;
position:relative; }
</style>
<link href= ". /css/css_default.css "rel=" stylesheet "type=" Text/css "/>
<body>
<form id= "Form1" runat= "Server" >
<div>
<div id= "Div_nav" class = "FL" >
<asp:treeview id= "tv_date" runat= "Server"
Onselectednodechanged= "Tv_date_selectednodechanged"showcheckboxes= "All">
</asp:TreeView>


<asp:button id= "btn_showlist" runat= "Server" text= "button"
onclick= "Btn_showlist_click"/>
</div>


<myatk:toolkitscriptmanager id= "ToolkitScriptManager1" runat= "Server" >
</myatk:ToolkitScriptManager>


<div id= "div_content" class = "FL" >

<asp:updatepanel id= "UpdatePanel1" runat= "Server" >
<ContentTemplate>
<asp:textbox id= "TextBox1" runat= "Server" ></asp:TextBox>


<asp:listview id= "ListView1" runat= "Server" datasourceid= "AccessDataSource1"
Itemplaceholderid= "Itemholder" >
<LayoutTemplate>
<div id= "Itemholder" runat= "Server" ></div>
</LayoutTemplate>


<ItemTemplate>
<asp:textbox id= "TXT_PM25" runat= "Server"
Text= ' <% #Eval ("Pm_val")%> '/>


<myatk:sliderextender id= "Textbox1_sliderextender" runat= "Server"
Enabled= "True" maximum= "minimum=" 0 "targetcontrolid=" TXT_PM25 "
handlecssclass= "Myhandle" handleimageurl= "~/img/handle_pm.png"
railcssclass= "Myrail" >
</myatk:SliderExtender>

</ItemTemplate>


</asp:ListView>
<asp:accessdatasource id= "AccessDataSource1" runat= "Server"
Datafile= "~/data/pm25.mdb"
Selectcommand= "SELECT * from [T_PM25] WHERE ([pm_id] =?)" >
<SelectParameters>
<asp:controlparameter controlid= "Tv_date" defaultvalue= "1" name= "pm_id"
Propertyname= "SelectedValue" type= "Int32"/>
</SelectParameters>
</asp:AccessDataSource>


</ContentTemplate>
<Triggers>
<asp:asyncpostbacktrigger ControlID = "Btn_showlist"/>
</Triggers>


</asp:UpdatePanel>


</div>


<div class = "CLR" ></div>


</div>
</form>
</body>

The. Aspx.cs code is as follows:

Using system;using system.collections.generic;using system.linq;using system.web;using System.Web.UI;using    System.web.ui.webcontrols;using System.data.oledb;public Partial class lesson_code_default2:system.web.ui.page{ String str_cnn = "Provider=Microsoft.Jet.OLEDB.4.0;    Data source= ";    String str_sourcefile = "~/data/pm25.mdb";    OleDbConnection CNN;    OleDbCommand cmd;    OleDbDataReader Datar;    String Str_sql; protected void Page_Load (object sender, EventArgs e) {if (!        IsPostBack) {maketree ();        }} protected void Maketree () {string str_conn = str_cnn + MapPath (str_sourcefile);        CNN = new OleDbConnection (Str_conn); Cnn.        Open ();        Str_sql = "SELECT * from T_PM25";        cmd = new OleDbCommand (Str_sql, CNN); Datar = cmd.        ExecuteReader ();        TreeNode _tnode; while (Datar.            Read ()) {_tnode = new TreeNode (); _tnode. Text = string.      Format ("{0:d}", (DateTime) datar["Pm_date"]);      _tnode. Value = datar["pm_id"].            ToString (); _tnode. Value = datar["Pm_val"].            ToString (); Tv_date.        Nodes.Add (_tnode); } CNN.    Close (); } protected void Tv_date_selectednodechanged (object sender, EventArgs e) {//textbox1.text = Tv_date.    SelectedValue;        } protected void Btn_showlist_click (object sender, EventArgs e) {string _values = ""; foreach (TreeNode _tnode in Tv_date. Checkednodes) {//traverse the entire tree _values + = _tnode.        Value + ",";//used to spell SQL statement} string _sql = "SELECT * from T_PM25 WHERE pm_id in (" +_values+ ")";        TextBox1.Text = _sql; Accessdatasource1.selectcommand = _sql;//Set CONTROL statement for data source}}

The effect is as follows:


Asp.net--slider controls

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.