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
Here is the original code.
Let me explain:
I have a table with Productionlines and a table with Computers. Enduser can define, which Computer works on which Productionline (Multiple choice is possible). Userinputs are stored in third table called by ComputerLine. On this way, I have two 1:n relationships (see DB-Diagram in attached file).
On Page I want display Productionlines and Computers in an own table. Enduser should be able to link the records in these tables. I would prefer to Drag and Drop, but I have also trouble (see DragDrop (WebGrid to WebTreeview) using WebPaneManager)
The easiest way to solve this issue: I load tables in separate Datasets, but I'm not happy with this idea...
How would you implement this scenario?
private DataSet ds; protected void Page_Load(object sender, EventArgs e) { ds = GetData(); } protected void grdLine_InitializeDataSource(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e) { e.DataSource = ds.Tables["Line"]; } protected void grdLine_PrepareDataBinding(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e) { if (!Page.IsPostBack) { grdLine.RetrieveStructure(); } } protected void grdPC_InitializeDataSource(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e) { e.DataSource = ds.Tables["Computer"]; } protected void grdPC_PrepareDataBinding(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e) { if (!Page.IsPostBack) { grdPC.RetrieveStructure(); } } protected void grdComputerLine_InitializeDataSource(object sender, DataSourceEventArgs e) { e.DataSource = ds.Tables["ComputerLine"]; } protected void grdComputerLine_PrepareDataBinding(object sender, DataSourceEventArgs e) { if (!Page.IsPostBack) { grdComputerLine.RetrieveStructure(); WebGridColumn colID = grdComputerLine.RootTable.Columns[0]; colID.Width = Unit.Pixel(100); colID.ColumnType = ColumnType.Text; WebGridColumn colLineID = grdComputerLine.RootTable.Columns[1]; colLineID.Width = Unit.Pixel(100); colLineID.ColumnType = ColumnType.Text; } } public DataSet GetData() { // Connection SqlConnection cn = new SqlConnection(); cn.ConnectionString = @"xxx"; cn.Open(); using (cn) { SqlCommand cmd = new SqlCommand(); cmd.Connection = cn; cmd.CommandText = "SELECT ID,Name FROM Production.Line; " + "SELECT ID,Name FROM Production.Computer; " + "SELECT ComputerID,LineID FROM Maintenance.ComputerLine"; SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = cmd; da.TableMappings.Add("Table", "Line"); da.TableMappings.Add("Table1", "Computer"); da.TableMappings.Add("Table2", "ComputerLine"); DataSet ds = new DataSet(); da.Fill(ds); da.FillSchema(ds, SchemaType.Source); DataRelation rel; rel = new DataRelation("relLineComputerLine", ds.Tables["Line"].Columns["ID"], ds.Tables["ComputerLine"].Columns["LineID"]); ds.Relations.Add(rel); rel = new DataRelation("relComputerComputerLine", ds.Tables["Computer"].Columns["ID"], ds.Tables["ComputerLine"].Columns["ComputerID"]); ds.Relations.Add(rel); return ds; }
Hi James
Thanks for your answer!
I have tested your code, but it doesn't works. The OnDragQuery Event isn't fired.
It's not enough to change effect, because I can also add Clildnodes only!
Regards
Michael
Thanks for your answer.
What did you mean with near future?
- WebUI 2009 R2?
- Next Year?
- Later?
I bound a DataSet on InitalizeDataSource-Event to WebGrid.
Hi Glenn
I have a table with 2 Foreignkey-Columns, which together define the Primarykey of this table.
The Columntypes are GUID. Small Batch Update is active.
On WebGrid1_PrepareDataBinding-Event I call RetrieveStructure().
If I add the following 2 Records, I get a Message from Website: The pending changes already contain a record with key ''
First Record:
00000000-0000-0000-0000-000000000001 and 10000000-0000-0000-0000-000000000000
Second Record:
00000000-0000-0000-0000-000000000002 and 10000000-0000-0000-0000-000000000000
On Debugmode I have seen, both columns are type of System.Guid and DataKeyField is not set.
How can I solve this problem?
Hi Dicky
Thank you for tip!
Hi Memo
You can use the client-side-event OnRowContextMenu.
function grdPL_OnRowContextMenu(controlId, rowType, rowElement, menuObject) { var i; for (i = 0; i < menuObject.Items.length; i ) { if (menuObject.Items[i] != null) { if (menuObject.Items[i].Name == "mnuHelp") { menuObject.Items[i - 1].Hide(); menuObject.Items[i].Hide(); } } } return true; }
Hope it helps.
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