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,
I have a multi column Web Combo, now i few columns like FirstName,Lastname,Age and Gender.
Now when user selects a particular record i want to show that records FirstName + LastName to the user as its TextField.
e.g. FirstName LastName Age Gender
Tom Blanks 50 Male
Peter Schuler 30 Male
Kareena Kapoor 24 Female
Now i select the Second record then the text Shown on Form to user should = > Peter Schuler not just Peter.
How can i achieve this?
Thanks,
You will need to create a temporary column in your datasource before binding it to the WebCombo in order to achieve the result you wanted.
Attached is the sample that has already implement such scenario.
Thanks Glenn
Unfortunately, for the scenario to work without any issue you will need to use the temporary column in the datasource technique.
IF you would like to create the column dynamically, you will need to use the PrepareDataBinding server side event handler. Here is the snippet:
protected void Combo1_PrepareDataBinding(object sender, ISNet.WebUI.WebCombo.DataSourceEventArgs e){ WebComboColumn fullName = new WebComboColumn(); fullName.BaseFieldName = "FullName"; fullName.HeaderText = "Full name"; fullName.Name = "FullName"; fullName.Hidden = true; fullName.RenderOnHidden = true; Combo1.Columns.Add(fullName); WebComboColumn firstName = new WebComboColumn(); firstName.BaseFieldName = "FirstName"; firstName.HeaderText = "First Name"; firstName.Name = "FirstName"; firstName.Width = Unit.Pixel(150); Combo1.Columns.Add(firstName); WebComboColumn lastName = new WebComboColumn(); lastName.BaseFieldName = "LastName"; lastName.HeaderText = "Last Name"; lastName.Name = "LastName"; lastName.Width = Unit.Pixel(150); Combo1.Columns.Add(lastName); WebComboColumn age = new WebComboColumn(); age.BaseFieldName = "Age"; age.HeaderText = "Age"; age.Name = "Age"; age.Width = Unit.Pixel(50); Combo1.Columns.Add(age); WebComboColumn gender = new WebComboColumn(); gender.BaseFieldName = "Gender"; gender.HeaderText = "Gender"; gender.Name = "Gender"; gender.Width = Unit.Pixel(100); Combo1.Columns.Add(gender);}
Templating has not been supported in the latest version of WebCombo. Currently integration between WebCombo and WebGrid is limited to WebCombo as an EditColumnType in the WebGrid.
If i have 50,000 rows and i dyanmically loop through datasource and add an extra column then it would be a big performance bottleneck.
Can't i just add temporray column to those records which are currently shown to user.
Like for first 15 rows i create a temporary column and display to user, then when user clicks for more then i create a temporray record for remaining 15 rows and so on...
Please suggest me a proper way if the number of records are more than 50,000.
Huzefa
For your scenario, you could add the new column to the datasource during IntializeDataSource server side event
protected void Combo1_InitializeDataSource(object sender, ISNet.WebUI.WebCombo.DataSourceEventArgs e){ DataTable dtData = new DataTable(); dtData.Columns.AddRange(new DataColumn[]{ new DataColumn("UserID"), new DataColumn("FirstName"), new DataColumn("LastName"), new DataColumn("Age"), new DataColumn("Gender") }); dtData.Rows.Add(new object[] { "1", "Tom", "Blanks", "50", "Male"}); dtData.Rows.Add(new object[] { "2", "Peter", "Schuler", "30", "Male" }); dtData.Rows.Add(new object[] { "3", "Kareena", "Kapoor", "24", "Female" }); dtData.Rows.Add(new object[] { "4", "John", "Doe", "40", "Male" }); dtData.Columns.Add(new DataColumn("FullName")); dtData.AcceptChanges(); e.DataSource = dtData;}
In order to fill the FullName data, you could use the InitializeRow server side event handler
protected void Combo1_InitializeRow(object sender, RowEventArgs e){ WebComboCell fName = e.Row.Cells.GetNamedItem("FirstName"); WebComboCell lName = e.Row.Cells.GetNamedItem("LastName"); WebComboCell fullName = e.Row.Cells.GetNamedItem("FullName"); fullName.Value = String.Join(" ", new string[] { fName.Text, lName.Text }); fullName.Text = String.Join(" ", new string[] { fName.Text, lName.Text });}
Regarding my earlier post to create the column programmatically, in order to render the hidden correctly, you will need to use the InitializeLayout server side event instead of PrepareDataBinding.
Hi Glenn,
Thanks for this solutions, it worked like a charm.
Few questions i want to ask you,
1) I want this combo to have Instant Lookup functionality as provided in your samples. But after i apply your above solution the instant lookup thing doesn't work. Can you provide a solution to get it proper on some real column.
2) How can i have more than 1 AdditionalFilterColumn in combo?
3) How can i have paging in combo instead of More button?
4) I want something like filter bar on top of each column so that after the dropdown is open user can filter on any additional column he wishes to. Can i do this in WebCombo? I need it please provide a way.
5) Once the user have selected a value and have posted the selection to server. Now i want to display the user his choice back. I have the user selected Id field value and want to set its Text to webCombo how can i do this? As Text property of WebCombo doesn't have a Setter. How can i achieve this?
The instant lookpup feature will not work if it is set to a hidden column. In order to allow the instant lookup feature to work you will need to use AdditionalSearchField property in order to allow WebCOmbo to search in the FirstName and LastName field, for example.
Our WebCombo documentation already have an article regarding AdditionalSearchField on the article titled Additional Search Field and How-to: Use AdditionalSearchField to search a query text on other column besides DataTextField column
Unfortunately both classic paging and filter on a specific column feature has not been supported in the current version of WebCombo.
On the server side, you will need to set the Value property in order to set the default choice in WebCombo, as detailed on the article How-to: Set initial value from server side in WebCombo in the WebCombo documentation. In the client side you could set the choice using the text by executing the SetTextBoxValue function, as detailed on the article How-to: Get/Set the TextBox value in the WebCombo documentation
In order to allow the instant lookup feature to work you will need to use AdditionalSearchField property in order to allow WebCOmbo to search in the FirstName and LastName field, for example.
How to set Multiple AdditionalSearchFields?
I have set the FirstName as AdditionalSearchField but when i type in a Name and press Tab, then the Filtered record is just 1 record but it doesn't get set, instead the DropDown result box opens up and i have to explicitly select a record.
What i want is after user Press Tab key and after filter if the number of records returned is just 1 then automatically set the Value and Text of that record. How can i achieve this?
On the server side, you will need to set the Value property in order to set the default choice in WebCombo, as detailed on the article How-to: Set initial value from server side in WebCombo in the WebCombo documentation.
I am not using any DataSource control instead i am Binding Data on InitializeDataSource Method.
I am checking if Action!="LoadData" and Value is set to something and Text is empty, then go to database filter the record on Value and get 1 record. After getting this one record i attach it to DataSource property of WebCombo. The Issue is i am adding a temporary column as you suggested and setting its text and value on InitializeRow event, but this event doesn't get called at all. And the text is not set. The WebCombo TextBox comes with empty text. Am i missing somehting?
Basically i want a LoadOnDemand functionality but i don't wanna use ISDataSource control or ObjectDataSource Control. Instead i manually call database and get a DataTable and bind this DataTable to DataSource of webCombo.
What would be the best approach for this?
In order to automatically set the WebCombo value to the shown dropdown item you will need to use EntryMode AutoComplete instead of InstantLookup.
Regarding the missing WebCombo text, in such scenario you will need to fill the virtual column (in this case FullName) as you set the value to the WebCombo. The InitializeRow server side event will be invoked when you show the WebCombo dropdown, in your scenario the InitializeRow will not be triggered.
Other suggestion regarding your scenario would be modifying the select query from the database. Instead of SELECT UserID, FirstName, LastName FROM [Users], please use SELECT UserID, FirstName, LastName, FirstName + ' ' + LastName AS FullName FROM [Users]
Can you please provide a sample or a proper code to illustrate how would i do this thing?
I am just getting a DataTable consisting of 1 row which is filetered on the Value in DTO object, and attaching this DataTable to WebCombo. I even add an extra column in DataTable for FullName and give its Value but nothing is shown on client side and TextBox of WebCombo remains empty.
Could you provide us with a running sample for what you are trying to do, or provide us with a snippet code for the event handler where you are trying to change the WebCombo data source.
This will allow us to replicate the scenario you are facing more accurately.
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