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
I'm discovering the possibilities for using client binding in our project. I'd like to perform a search, without refreshing the page and binding results to the grid.
Client binding sounds good, however, I can't find any sample with client binding that sends parameters to the server to request the datasource.
- Is it possible to send parameters to the server for client binding?
- If yes, is there a example available?
Thanks in advance.
Client-side binding includes a special ServerDataSource mode to enable you to quickly leverage existing server-side infrastructure while taking advantage of many benefits introduced by client binding. This means that you can still connect WebGrid to a server-side data source – such as SqlDataSource, ObjectDataSource, LinqDataSource – data source object assigned in InitializeDataSource event; while performing data binding operation in the client side.
I enclosed one simple sample of WebGrid bind to ISDataSource where the select method is based on a parameter (country parameter). Please have the attached sample tested on your end and let me know if you have different scenario.
Perfect solution, thanks for the clear sample. Very quick sample too!
Glad to hear the good news.
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.
Just thinking about one little addition to this question.
Because the client bound grid is used as part of a search page, the grid shouldn't be filled when the page opens. This is, however, the case at the moment because DataSourceID is set already.
Is it someway, somehow possible to perform databinding just the same way as in the sample, but with an empty grid on page load?
Thanks.
Regards,
Herman
The sample on previous post will get the parameter from DropDownList1 control where on page load, the value/text of the DropDownList1 is “Australia”.
In order to have empty WebGrid on page load, simply add a parameter that will return no rows. Adding a DropDownList item that is not enlisted in “Country” column of the data source will cause the grid show empty rows on page load.
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { DropDownList1.Items.Add("Please select a country"); DropDownList1.Items.Add("Australia"); DropDownList1.Items.Add("Brazil"); DropDownList1.Items.Add("Canada"); DropDownList1.Items.Add("Denmark"); DropDownList1.Items.Add("Finland"); DropDownList1.Items.Add("France"); DropDownList1.Items.Add("Germany"); DropDownList1.Items.Add("Italy"); DropDownList1.Items.Add("Japan"); DropDownList1.Items.Add("Netherlands"); DropDownList1.Items.Add("Norway"); DropDownList1.Items.Add("Singapore"); DropDownList1.Items.Add("Spain"); DropDownList1.Items.Add("Sweden"); DropDownList1.Items.Add("UK"); DropDownList1.Items.Add("USA"); DropDownList1.Attributes["onchange"] = "return DropDownList1_OnChange()"; } }
Hope this helps.
Just one more thing. I'm now at the stage whereby I need to add some templated databound columns to the above example. With other, not clientbinding grids, templated columns works as designed, however with clientbinding it returns a javascript error:
line 8char 38880"'null' is null or not an object"
My column definition is as follows:
<ISWebGrid:WebGridColumn Caption="Test" DataMember="UserName" ColumnType="Template" Width="100px"> <CellTemplate> <asp:Label ID="Label7" runat="server" Text='Test' /> </CellTemplate> </ISWebGrid:WebGridColumn>
Currently just for test, but it simple doesn't work with 'DataMember' assigned. If I leave that empty, it works, but unfortunatly I do need the data.
My last try was defined like this:
<ISWebGrid:WebGridColumn Caption="Test" ColumnType="Template" Width="100px"> <CellTemplate> <asp:Label ID="Label7" runat="server" Text='<%# Test() %>' /> </CellTemplate> </ISWebGrid:WebGridColumn>
It calls a server side method to calculate some text, but unfortunatly it doesn't call the method (by debugging it's not stepping into at least).
So I'm a little bit lost about what to do and how to get some custom data in it. I'd like to display a subproperty from the dataobject (Department.Code), which is not possible to do without a TemplatedColumn I believe.
Anyone got an idea? Thanks in advance.
Template column hasn’t been supported yet in ClientBinding scenario with current version of WebGrid 7 since ClientBinding renders the data in client not server. It is, currently, one of the limitations of ClientBinding feature.
We’ll provide client-side template in the next version. I have submitted this as feature request (Task #661) to WebGrid development team. I’ll keep you updated with any news I heard from the team regarding this.
Yudi,
Thanks for the clarifying response! That explains it all.
I've a workaround in mind by wrapping or modifying my object model, so that sub properties will read as a String. Maybe you've encountered more of template column requests for client binding with a more decent solution? (Not so important question, but maybe you or someone has a nice solution.)
Thanks again!
Sorry to let you know that currently I have no sample of WebGrid that uses template column on client binding scenario.
Should you find any workaround for this scenario, I hope you don’t mind to share the knowledge with us. I’m sure it will help other member that has the same requirement as your scenario.
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