iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
NO,DblClick one cell of WebGrid2 then did not focus back into WebGrid1, focus into WebGrid2 again.
(When I DblClick one cell of WebGrid2 ,one cell of webgrid1 Get Focus but at once the cell of webgrid1 lost Focus and the cell of WebGrid2 Get Focus again.I think the reason is:DblClick event cause cell into EditState,can not lostfocus from EditState.what is your suggest?? )
But I want to DblClick one cell of WebGrid2,the cell lost Focus and one of webgrid1 Get Focus !
Hope you can help me!thank you!
thank you Yudi :
You are really a smart Man!!
I have rewrite OnCellDblClick!WebGrid2:<ClientSideEvents OnCellDblClick="WebGrid2_Dbclick" />
I want to do:
when i DblClick one cell of WebGrid2,the cell lost Focus and one of webgrid1 Get Focus
BUT the problem is that:
when i DblClick one cell of WebGrid2(How to Cancel dblClick Cell into EditState,because I still want to Use Edit!!!!),one cell of webgrid1 Get Focus but at once the cell of webgrid1
lost Focus and the cell of WebGrid2 Get Focus Again
WebGrid2_Dbclick Code:
function WebGrid2_Dbclick() { var grid1 = ISGetObject("WebGrid1"); var grid2 = ISGetObject("WebGrid2"); var totalRowCount = grid1.TotalRows; var paRow = grid2.GetSelectedObject().GetRowObject(); var childRow = grid1.RootTable.NewRow(); var pacell = paRow.GetCells(); var chilcell = childRow.GetCells(); var s1 = pacell.GetNamedItem("商品编号").Text; var s2 = pacell.GetNamedItem("商品名称").Text; var s3 = pacell.GetNamedItem("商品规格").Text; var s4 = pacell.GetNamedItem("包装单位").Text; var s5 = pacell.GetNamedItem("数量").Text; chilcell.GetNamedItem("vouid").SetText(totalRowCount + 1, true); chilcell.GetNamedItem("商品编号").SetText(s1, true); chilcell.GetNamedItem("商品名称").SetText(s2, true); chilcell.GetNamedItem("商品规格").SetText(s3, true); chilcell.GetNamedItem("包装单位").SetText(s4, true); chilcell.GetNamedItem("数量").SetText(s5, true); grid1.XmlHttp.Asynchronous = false; childRow.Update(); grid1.SetFocus(); grid1.RootTable.GetRow(totalRowCount).Select(); grid1.RootTable.GetRow(totalRowCount).GetCells()[1].ActivateEdit(); }
Hey, thank you Handy~you are so kind to me!!!!
Hi Yudi,
I have Creat a Webgrid by your way~
but when I click "Refresh" of the webgrid , the page also refresh!It seems that it is very Bad!
How to: click "Refresh" of the webgrid ,but the page doen not refresh?
Waiting for you on line!!!!!
My c# Code(You may change your language to Chinese):
#region dynamicCreateWebgrid protected void Button11_Click1(object sender, EventArgs e) { dynamicGridInit(); } public void dynamicGridInit() { WebGrid grid = new WebGrid(); grid.ID = "WebGrid5"; grid.Width = System.Web.UI.WebControls.Unit.Pixel(800); grid.Height = System.Web.UI.WebControls.Unit.Pixel(100); grid.UseDefaultStyle = true; grid.InitializeDataSource += new ISNet.WebUI.WebGrid.DataSourceEventHandler(grid_InitializeDataSource); grid.PrepareDataBinding += new ISNet.WebUI.WebGrid.DataSourceEventHandler(grid_PrepareDataBinding); grid.InitializeLayout += new ISNet.WebUI.WebGrid.LayoutEventHandler(grid_InitializeLayout); form1.Controls.Add(grid); } private void grid_PrepareDataBinding(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e) { //if (!IsPostBack) //{ WebGrid grid = (WebGrid)sender; grid.RetrieveStructure(); //} } protected void grid_InitializeLayout(object sender, ISNet.WebUI.WebGrid.LayoutEventArgs e) { WebGrid grid = (WebGrid)sender; grid.LayoutSettings.AllowContextMenu = true; grid.LayoutSettings.AllowExport = Export.Yes; grid.LayoutSettings.AlternatingColors = false; grid.LayoutSettings.AllowSelectColumns = SelectColumns.Yes; grid.LayoutSettings.AllowEdit = Edit.Yes; grid.LayoutSettings.StatusBarStyle.BackColor = System.Drawing.Color.Chocolate; } protected void grid_InitializeDataSource(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e) { e.DataSource = mytb(); } public DataSet mytb() { DataSet ds = new DataSet("tb_Employee"); ds.ExtendedProperties["TimerStamp"] = DateTime.Now; ds.ExtendedProperties["Company"] = "www.sina.com"; DataColumn EmployeeIDColumn = new DataColumn("EmployeeID", typeof(int)); EmployeeIDColumn.Caption = "员工编号"; EmployeeIDColumn.ReadOnly = true; EmployeeIDColumn.AllowDBNull = false; EmployeeIDColumn.Unique = true; EmployeeIDColumn.AutoIncrement = true; EmployeeIDColumn.AutoIncrementSeed = 0; EmployeeIDColumn.AutoIncrementStep = 1; DataColumn EName = new DataColumn("EName", typeof(string)); DataColumn ESex = new DataColumn("ESex", typeof(string)); DataColumn EAge = new DataColumn("EAge", typeof(int)); DataColumn EPlace = new DataColumn("EPlace", typeof(string)); DataColumn EMoney = new DataColumn("EMoney", typeof(int)); DataTable dt = new DataTable("tb_Employee"); dt.Columns.AddRange(new DataColumn[] { EmployeeIDColumn, EName, ESex, EAge, EPlace, EMoney }); DataRow dr = dt.NewRow(); dr["EName"] = "huangjshhhh"; dr["ESex"] = "男"; dr["EAge"] = 20; dr["EPlace"] = "上海"; dr["EMoney"] = 10000; dt.Rows.Add(dr); dr = dt.NewRow(); dr["EName"] = "chengshuang"; dr["ESex"] = "女"; dr["EAge"] = 20; dr["EPlace"] = "北京"; dr["EMoney"] = 10000; dt.Rows.Add(dr); dt.PrimaryKey = new DataColumn[] { dt.Columns[0] }; ds.Tables.Add(dt); return ds; } #endregion
thank you Handy Surya:
I think I have solved the simple problem by only severside
display the last page:
jscode:
function MoveLastPage() { var grid = ISGetObject("WebGrid1"); grid.GotoLastPage(); }
C#code: protected void Button1_Click(object sender, EventArgs e) { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "MoveLastPage();", true); }
thank you Yudi !
thank you Handy Surya;
the answer is perfect!
Like this:
:using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using H.Database; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ISNet.WebUI.WebGrid; using ISNet.WebUI.WebCombo; namespace WebApplication1 { public partial class Demo : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindList(); } } protected void BindList() { using (StoreDA da = new StoreDA()) { var aa = da.Query(); this.WebGrid1.DataSource = da.Query1(TextBox1.Text); WebGrid1.RetrieveStructure(); WebGrid1.DataBind(); WebGrid1.RootTable.DataKeyField = "序列号"; WebGrid1.RootTable.Columns.GetNamedItem("序列号").IsRowChecker = true; } } protected void WebGrid1_InitializeDataSource(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e) { // BindList(); using (StoreDA da = new StoreDA()) { var aa = da.Query1("");//this is a query SQl,get a datatable e.DataSource = aa; WebGrid1.RetrieveStructure(); WebGrid1.RootTable.DataKeyField = "序列号"; WebGrid1.DataBind(); WebGrid1.RootTable.Columns.GetNamedItem("序列号").IsRowChecker = true; } } protected void WebGrid1_PrepareDataBinding(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { using (StoreDA da = new StoreDA()) { var aa = da.Query1(TextBox1.Text); WebGrid1.DataSource = aa; WebGrid1.RetrieveStructure(); WebGrid1.RootTable.DataKeyField = "序列号"; WebGrid1.DataBind(); WebGrid1.RootTable.Columns.GetNamedItem("序列号").IsRowChecker = true; } } protected void Button2_Click(object sender, EventArgs e) { using (StoreDA da = new StoreDA()) { var aa = da.Query2(TextBox2.Text); WebGrid1.DataSource = aa; WebGrid1.RetrieveStructure(); WebGrid1.RootTable.DataKeyField = "序列号"; WebGrid1.DataBind(); WebGrid1.RootTable.Columns.GetNamedItem("序列号").IsRowChecker = true; } } protected void Button3_Click(object sender, EventArgs e) { using (StoreDA da = new StoreDA()) { var aa = da.Query3(TextBox3.Text); WebGrid1.DataSource = aa; WebGrid1.RetrieveStructure(); WebGrid1.RootTable.DataKeyField = "序列号"; WebGrid1.DataBind(); WebGrid1.RootTable.Columns.GetNamedItem("序列号").IsRowChecker = true; } } protected void Button4_Click(object sender, EventArgs e) { using (StoreDA da = new StoreDA()) { var aa = da.Query4(TextBox4.Text); WebGrid1.DataSource = aa; WebGrid1.RetrieveStructure(); WebGrid1.RootTable.DataKeyField = "序列号"; WebGrid1.DataBind(); WebGrid1.RootTable.Columns.GetNamedItem("序列号").IsRowChecker = true; } } when I input some informations and click a button,get a new dataset,I want bind the dataset to the same webgrid!How can I do ?Please help me!thank you!
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname