using System; using CoreSavingLibrary; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; namespace Saving.Applications.admin.w_sheet_am_amsecwinsgroup_ctrl { public partial class DsDetail : DataSourceRepeater { public DataSet1.AMSECWINSGROUPDataTable DATA { get; private set; } public void InitDs(PageWeb pw) { //ปิด css1 ตอนรันไทม์ เปลี่ยนไปใช้ css ของเฟรมแทน css1.Visible = false; //ประกาศ dataset DataSet1 ds = new DataSet1(); //ตั้งค่า property DATA เอา DataTable จาก DataSet มาใช้ this.DATA = ds.AMSECWINSGROUP; //ตั้งชื่อ event ItemChanged ในรูปแบบ On<ชื่อ WebUserControl>ItemChanged this.EventItemChanged = "OnDsDetailItemChanged"; //ตั้งชื่อ event ItemChanged ในรูปแบบ On<ชื่อ WebUserControl>ItemChanged this.EventClicked = "OnDsDetailClicked"; //เรียกคำสั่งในคลาสแม่ให้การ init ก่อน //argument ที่ 2 ใส่ object ของ WebUserControl, argument ที่ 4 ใส่ชื่อขึ้นต้นตัวเล็ก) this.InitDataSource(pw, Repeater1, this.DATA, "dsDetail"); //กรณีมีปุ่มให้ใช้คำสั่งนี้ add เพื่อให้เกิด event clicked ที่ปุ่ม this.Button.Add("b_del");//ถ้าหน้าจอไม่มีปุ่มให้ลบหรือคอมเมนท์บรรทัดนี้ //เรียกให้คลาสแม่ทำงานอีกครั้ง this.Register(); } public void Retrieve(String application) { string sql = "select * from amsecwinsgroup where application='" + application + "' and coop_control='" + state.SsCoopControl + "' order by application, group_order"; DataTable dt = WebUtil.Query(sql); //ทำยังไงก็ได้ให้ได้ DataTable หรือ Xml String ที่มีข้อมูล แล้วนำมาใช้คำสั่ง ImportData this.ImportData(dt); } } }