DataList.

Slides:



Advertisements
Similar presentations
Complete Structure class Date {class Date { private :private : // private data and functions// private data and functions public :public : // public data.
Advertisements

For(int i = 1; i
Buffer Overflow Prabhaker Mateti Wright State University.
Class Scope class Student { private: string id; string firstName, lastName; float gpa; public: void Read() { cin >> id >> firstName >> lastName >> gpa;
Chapter 8. Operator Overloading Operator overloading gives the opportunity to redefine C++ Operator overloading refers to redefine C++ operators such.
Tinaliah, S. Kom.. * * * * * * * * * * * * * * * * * #include using namespace std; void main () { for (int i = 1; i
Triana Elizabeth, S.Kom. #include using namespace std; void main () { for (int i = 1; i
ASP.NET and ADO.NET. ASP.NET Server Controls Intrinsic Controls: These controls correspond to their HTML counterparts. –Ex. Textbox, listbox, button,
Creating web service (and client application) with Visual Studio 2008 Create web service project New project->web->ASP.NET web service application (with.
CST238 Week 7 Questions / Concerns? Announcements – HW#2 due today (project concept/preliminary design) – Check-off Take Home lab#6 Friday is the last.
Developing Applications for Mobile Devices Dr. Frank McCown GUI Programming Fall 2008.
Expression ISYS 350. Performing Calculations Basic calculations such as arithmetic calculation can be performed by math operators OperatorName of the.
ASP Hello, world. ServerClient Response Request A form.
INSPIRING CREATIVE AND INNOVATIVE MINDS Module 4: Adding Code to a Microsoft ASP.NET Web Form Implementing Code-Behind Pages Adding Event Procedures to.
Session 08: Architecture Controllers or Managers Graphical User Interface (GUI) FEN AK - IT Softwarekonstruktion.
Web Controls Making a WebRequest using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; using System.IO;
Module 3: Working with Components. Overview An Introduction to Key.NET Framework Development Technologies Creating a Simple.NET Framework Component Creating.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Unit 3: Adding Code to a Microsoft ASP.NET Web Form.
ADO.NET. ADO.NET 精靈化設計 精靈化設計 程式化設計 程式化設計 SQL 指令 SQL 指令 DataGrid, DataList DataGrid, DataList DataBind DataBind.
Using Adapter Wizard ISYS 512. Data Adapter Wizard – 2 nd Level of Using ADO.Net Configure Data Adapter and generating a dataset: –From the Data tab of.
Module 3: Using Microsoft.NET- Based Languages. Overview Overview of the.NET-Based Languages Comparison of the.NET-Based Languages.

More ASP.NET Database In a properly organized application, your data access code is never embedded directly in the code-behind for a page. Instead, it’s.
Public class Edo1 { private static double euler(double y, double h, double t, Derivada d) { return y + h * d.f(y, t); } public static void euler(double.
[ServiceContract] public interface IJokeOfTheDayService { [OperationContract] string GetJoke(int jokeStrength); }
Module 4: Creating a Web Application with Web Forms
Created by Alia Al-Abdulkarim 2008 Visual Basic Vs. Java.
Databases – Unit 3 & 4.  SQL is not restricted to a specific database, however in class we will be looking at the two major database programmes in use.
3 private void equalsButton_Click( object sender, RoutedEventArgs e) { calculateResult(); }
ADO.NET Objects Data Adapters Dr. Ron Eaglin. Agenda Builds on Information in Part I Should have working knowledge of creating a database connection Continuation.
Data tastes like chicken, if chicken was data.. Databinding What is it? Associating a set of data with a control Why use it? Its much easier than associating.
Print Row Function void PrintRow(float x[ ][4],int i) { int j; for(j=0;j
Exercise 6 Introduction to C# CIS Create a class called ParseDates that will parse a formatted string containing a date into separate integers.
C# Classes ISYS 512. Introduction to Classes A class is the blueprint for an object. –It describes a particular type of object. –It specifies the properties.
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
Coding ADO.Net DataSet Objects ISYS 512. DataSet Object A DataSet object can hold several tables and relationships between tables. A DataSet is a set.
PLACING ORDERS- SHOPPPING CARTS. Introduction There are several stages to the order process, starting with an order page, which allows customers to add.
Introduction to Methods ISYS 350. Methods Methods can be used to break a complex program into small, manageable pieces – This approach is known as divide.
제 21 장 : ADO.NET 을 이용한 데이터 접근. ADO.NET - DataSet 사용하기.
Windows form programming. namespace MyNamespace { public class MyForm : System.Windows.Forms.Form { public MyForm() { this.Text = "Hello Form"; }
DC Motor – H bridge L293D ile Kontrolü /* Adafruit Arduino - Lesson 15. Bi-directional Motor */ int enablePin = 11; int in1Pin = 10; int in2Pin = 9; int.
Expression ISYS 350.
Array ISYS 350.
Programming SharePoint Object Model, Web Services, and Events
Service-Oriented Computing -- Service Provider and Application Builder
Expression ISYS 350.
Array ISYS 350.
Array ISYS 350.
Array ISYS 350.
Windows Azure Storage Queue Storage.
1.الدوال Function 2.الاجراءاتSub Procedure 3.وحده نمطيه Add Module
Array ISYS 350.
searching Concept: Linear search Binary search
Expression ISYS 350.
Module 10: Creating a Web Application with Web Forms
Expression ISYS 350.
class PrintOnetoTen { public static void main(String args[]) {
Web Service.
Expression ISYS 350.
Array ISYS 350.
ASP.NET and ADO.NET.
Expression ISYS 350.
BMI Form1 Body Mass Index textBox3-4 (readonly) trackBar1
子母視窗傳值 by JS.
Simple MS Access operations
AB form1 Multiplication textBox1 12 textBox2 34 textBox3
Jim Fawcett CSE686 – Internet Programming Spring 2011
Chapter 11 Classes.
label1 Name label2 Time (0-23) textBox1 textBox2 textBox3 button1
Command Object’s ExecuteNonQuery Method
Presentation transcript:

DataList

DataList 不支援分頁 不支援資料編修 其餘功能與DataGrid類似

DataList

DataList

DataList

DataList

DataList

DataList

DataList

DataList

DataList

DataList

DataList

DataList

DataList

DataList

DataList

DataList

DataList 顯示不出資料 與DataGrid不同

DataList

DataList <%# DataBinder.Eval(Container.DataItem,"CustomerID")%> 要顯示的欄位名稱

DataList

資料表關聯

DataList

DataList

DataList

DataList

DataList

分頁 DataList不要設定DataSource

DataList

DataList

DataList private void Page_Load(object sender, System.EventArgs e) { // 在這裡放置使用者程式碼以初始化網頁 sqlDataAdapter1.Fill(dataSet31); if(!IsPostBack) ViewState["CurrentPage"]=1;//設定目前瀏覽第一頁 ViewState[“PageSize”]=10;//預設一次瀏覽五筆 BindData(); }

DataList public void BindData() { int TotalRecord,PageCount; //計算總筆數 TotalRecord = dataSet31.Tables["Orders"].Rows.Count; ViewState["TotalRecord"] = TotalRecord; tot_count.Text = "總筆數:" + TotalRecord.ToString(); //計算總頁數 PageCount = (TotalRecord-1) / Convert.ToInt32(ViewState["PageSize"]) +1; ViewState["PageCount"]=PageCount; tot_page.Text = "總頁數:" + ViewState["PageCount"].ToString(); ….接後頁

DataList //清空下拉頁數選單 pagelist.Items.Clear(); for(int i=1;i<=PageCount;i++) { ListItem lipage=new ListItem(Convert.ToString(i),Convert.ToString(i)); pagelist.Items.Add(lipage); } if(TotalRecord > 0) PagedDataSource pds=new PagedDataSource(); pds.DataSource=dataSet31.Tables["Orders"].DefaultView; pds.AllowPaging=true; pds.PageSize=Convert.ToInt32(ViewState["PageSize"]); pds.CurrentPageIndex=Convert.ToInt32(ViewState["CurrentPage"])-1; DataList1.DataSource = pds; DataList1.DataBind();

DataList

DataList 下拉

DataList private void pagelist_SelectedIndexChanged(object sender, System.EventArgs e) { ViewState["CurrentPage"]=pagelist.SelectedItem.Value; BindData(); }

DataList

DataList private void TextBox1_TextChanged(object sender, System.EventArgs e) { ViewState["PageSize"]=Convert.ToInt16(TextBox1.Text); BindData(); }

DataList 傳統按鈕跳頁方式 private void top_page_Click(object sender, System.EventArgs e) { // 首頁 ViewState["CurrentPage"] = 1; BindData(); }

DataList private void next_page_Click(object sender, System.EventArgs e) { int CurrentPage,PageCount; //下一頁 CurrentPage = (int)ViewState["CurrentPage"]; PageCount = (int)ViewState["PageCount"]; if(CurrentPage<PageCount) CurrentPage++; ViewState["CurrentPage"] = CurrentPage; BindData(); }

DataList private void pre_page_Click(object sender, System.EventArgs e) { int CurrentPage; //前一頁 CurrentPage = (int)ViewState["CurrentPage"]; if(CurrentPage>1) CurrentPage--; ViewState["CurrentPage"] = CurrentPage; BindData(); }

DataList private void last_page_Click(object sender, System.EventArgs e) { int PageCount; PageCount = (int)ViewState["PageCount"]; // 末頁 ViewState["CurrentPage"] = PageCount; BindData(); }

DataList 使用commandname方式跳頁

DataList 設定jump_page事件

DataList

DataList

private void jump_page(object sender, System. Web. UI. WebControls private void jump_page(object sender, System.Web.UI.WebControls.CommandEventArgs e) { int CurrentPage,PageCount; CurrentPage = (int)ViewState["CurrentPage"]; PageCount = (int)ViewState["PageCount"]; //按首上下末頁時 switch(e.CommandName) case "pre": if(CurrentPage>1) CurrentPage--; break; case "next": if(CurrentPage<PageCount) CurrentPage++; case "top": CurrentPage = 1; case "lst": CurrentPage = PageCount; } ViewState["CurrentPage"] = CurrentPage; BindData();

新增/修改

新增/修改 private void Button6_Click(object sender, System.EventArgs e) { // 修改 SqlDataAdapter da=new SqlDataAdapter("update employees set lastname='" + TextBox3.Text + "' where employeeid=" + Convert.ToInt32(TextBox2.Text),sqlConnection1); da.Fill(dataSet21,"employees"); sqlDataAdapter1.Fill(dataSet21); DataList1.DataBind(); BindData(); }