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
Hi,
We have to bind a WebValueList (say B) from different list during adding a new row on change of another WebValueList (say A). Which clientSide event should be used for this and if possible please provide some sample .
For Example :-
WebValueList A has three values ABC, DEF and GHI
If WebValueList A's selected value is ABC then Fruit should populated , for DEF the list of Vegitables etc and for GHI the list of grain.
thanks
Attached sample shows linked WebCombo inside WebGrid. The parent WebCombo is the Supplier combo. The Products combo is filtered based on what user select from Supplier combo.
Please have the attached sample evaluated on your end and let me know whether this helps or not.
I modified the WebCombo part of Supplier-Product WebCombo (from my previous sample) based on the following information:
Please have the modified WebCombo sample evaluated on your end and let me know whether it helps or not.
I was using "OnInitializeDataSource" and "OnPrepareDataBinding" events for declartive columns in aspx page. Once I removed both events and bind grid on page load , it starts working. I believe that I can bind grid on "OnInitializeDataSource" event by using columns setting in event also.
Before we go further with the link WebCombo as WebGrid's editor questions, I'd like to straighten out few things first. Yes, you are correct. You can bind grid on OnInitializeDataSource event. Removing data source assignment from OnInitializeDataSource to Page_Load event similar to manually populate WebGrid row (instead of binding it to a data source) means that the Grid is operating in unbound mode. Please note that when WebGrid is operating in unbound mode, all data-bound features – such as sorting, grouping, exporting, etc – should not be enabled.
BindtoTraditionalDataSource sample of WebGrid shows the usage of OnInitializeDataSource and OnPrepareDataBinding server-side event. Hope this helps.
Requests are
Please modiy the sample such a way that all data-bound features would be available. Hope the sample would be able to explain the problem we are facing.
thanks and regards
Sjain
Thank you for the sent sample.
I’m currently investigating the sample and will get back to you as soon as possible.
Edited on November 2, 2015 6:35 AMReason: Update solution
If I try to select SupplierId first then ProductName shows empty rows.
The ProductName combo shows empty rows because it was filtered by a white space. Please allow me to show where the "white space" is.
By default, WebCombo will filter its items based on the character typed or entered in the texbox. The result will be shown in the ResultBoxWindow of WebCombo.
It shows empty rows because there is a white-space in the textbox. "Starts with" empty-space is applied to the WebCombo items. It shows empty rows because the filter results is null. No rows match after the filter applied, in this case is "Starts with" empty-space.
Please follow the steps below in order to resolve this white-space problem:
After the changes, the code will look like following snippet code:
protected void WebGrid1_PrepareDataBinding(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e) { //WebGrid grid = (WebGrid)sender; if (!IsPostBack) { //WebGrid1.ClearCachedDataSource(); WebGrid1.RetrieveStructure(); if (WebGrid1.RootTable.Columns.Exists("SupplierID")) { WebGrid1.RootTable.Columns.GetNamedItem("SupplierID").EditType = EditType.WebComboNET; WebGrid1.RootTable.Columns.GetNamedItem("SupplierID").WebComboID = "WebComboSuppliers"; WebGrid1.RootTable.Columns.GetNamedItem("SupplierID").FilterEditType = FilterEditType.TextBox; WebGrid1.RootTable.Columns.GetNamedItem("SupplierID").DefaultText = string.Empty; WebGrid1.RootTable.Columns.GetNamedItem("SupplierID").DefaultValue = string.Empty; //WebComboSuppliers.Visible = true; } if (WebGrid1.RootTable.Columns.Exists("ProductName")) { WebGrid1.RootTable.Columns.GetNamedItem("ProductName").EditType = EditType.WebComboNET; WebGrid1.RootTable.Columns.GetNamedItem("ProductName").WebComboID = "WebComboProducts"; WebGrid1.RootTable.Columns.GetNamedItem("ProductName").FilterEditType = FilterEditType.TextBox; WebGrid1.RootTable.Columns.GetNamedItem("ProductName").DefaultText = string.Empty; WebGrid1.RootTable.Columns.GetNamedItem("ProductName").DefaultValue = string.Empty; //WebComboSuppliers.Visible = true; } WebGrid1.RootTable.Columns.GetNamedItem("ProductID").Visible = false; } }
Please feel free to let me know if you have different result.
Once the selection from both combo is done then I can only change data after deleting the text inside otherwise in list only selected text is shown.
This is not bug. By default, WebCombo will show only one value after you input a text such as Maria. However, you can show all rows on dropdown by enabling AlwaysShowAllRowsOnDropdown property of WebCombo. This property Determines whether or not to display all rows when dropdown arrow is clicked.
To always show all rows on dropdown combo
Hope this helps.
On Selection of ProductName need to autofeel 10 and some custom Text in QuantityPerUnit new row's cell.
You can try to use these approaches for such scenario.
First option: to use OnExitEditMode of WebGrid.
OnExitEditMode client-side event of WebGrid specifies the client side (JavaScript) function that will be invoked when edit mode is being ended. Add following snippet code in OnExitEditMode will auto fill string to QuantityPerUnit cell.
function WebGrid1_OnExitEditMode(controlId, tblName, editObject) { var WebGrid1 = ISGetObject(controlId); var editObjValue = editObject.element.Value; if (editObject.element.Name == "WebComboProducts" && editObjValue == "1") { var selObj = WebGrid1.GetSelectedObject(); var cell = selObj.ToRowObject().GetCells(); cell.GetNamedItem("QuantityPerUnit").SetText("10 and some custom text", true); cell.GetNamedItem("QuantityPerUnit").SetValue("10 and some custom text"); } return true; }
Another option is to use OnAfterItemSelected client-side event of WebCombo, in this case is the WebComboProducts.
OnAfterItemSelected client-side event of WebCombo specifies the client side (JavaScript) function that will be invoked after an item is selected. The following is the example on how to set text and value of QuantityPerUnit cell in WebGrid after an item of ProductsCombo is selected.
function WebComboProducts_OnAfterItemSelected(controlId) { var combo = ISGetObject(controlId); var grid = ISGetObject("WebGrid1"); var row = grid.GetSelectedObject().GetRowObject(); if (combo.Text == "Chai") { var cells = row.GetCells(); var cellQuantityPerUnit = cells.GetNamedItem("QuantityPerUnit"); cellQuantityPerUnit.SetText("10 and some custom text", true); cellQuantityPerUnit.SetText("10 and some custom text"); } return true; }
Hope this help.
Glad to know that OnExitEditMode/OnAfterItemSelected helps.
Should you need further assistance or run into any problems regarding our controls, feel free to post it into our forum. We would be happy to assist you again.
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