I have my WebDataGrid bound to a SqlDataSource that uses a ControlParameter. Using javascript, I've updated that control's value, but the WebDataGrid is not re-binding until a postback; I'd like to trigger the databind without a postback.
Any help on this?
P.S. The CSOM documentation is extremely weak. We (developers) desperately need more examples of methods being used and more details on the methods' return values. It's like pulling teeth (my own!) every time I try to figure out how to accomplish something via javascript.
There is no Java Script method that would make the grid to do an Ajax request for the data to the server based on an external control value as a databind parameter.
I'd suggest you to put both the grid and the control into an UpdatePanel and trigger a post back when the control's value changes.
Thanks Alexander,
I've never used the UpdatePanel before, do I simply drop the controls beneath that tag? The controls I'm using are HiddenFields, so I don't mind where they are placed.
How would I "trigger a post back when the control's value changes"?
Bryan,
You will find a great beginner's guide to getting started with AJAX, as well as using the UpdatePanel, here:
http://www.asp.net/learn/ajax-videos/video-75.aspx
Hope this helps.
I've played with the UpdatePanels and I see how they CAN be used to "bypass" a postback and do a partial-postback instead. However, I am still unable to set a trigger on the WebDataGrid's RowSelectionChanged event.
Here is what I'm trying to accomplish. I have a WebDataGrid that contains a list of Employees. I then have another WebDataGrid that contains a list of Approved Clients. When the user selects one or more Employees from the first grid, I want to refresh the second WebDataGrid to show only those clients who are assigned to the selected Employee(s).
I do not want to use filtering, because the approved dataset could get potentially very large, so I don't want to pull the entire dataset down. I have a SelectParameter on the Approved's SqlDataSource for the employee's usernames. Here are the ways I've tried to implement this, that I have not been able to get to work: 1) Use a ControlParameter on the Approved SqlDataSource that points to the selected DataKey value for the Employees WebDataGrid. (There's no SelectedValue or equivalent member variable on the WebDataGrid) 2) Drop everything into an UpdatePanel (Can't get a postback to occur on row-selection, and not sure if that would work anyway, since I want to support multiple selections). 3) Use PageMethods to databind the Approved WebDataGrid after setting the select parameters (Can't access instance members like the grids from the static PageMethods), 4) Use CSOM to trigger the WebDataGrid to DataBind after setting a HiddenField for the selected employee's names (which are used as a ControlParameter on the SqlDataSource)
Any suggestions, I've been working on this for 4 days now and I'm getting pretty frustrated trying to use this newly purchased toolkit.
Thanks,
Bryan
Hi Bryan,
Sorry to having to point you in yet another direction for your answer, but the scenario you've explained is implemented in one of the samples we've shipped. In this case, when you click on a row a chart is updated with the selected row's data, but the idea is the same.
WebDataGrid, doesn't trigger a postback automatically. However, you can force it by handling client side event. Take a look at this sample, click on a row and see the chart refresh.
https://www.infragistics.com/samples/aspnet/data-grid/dashboard
You can click on the source code tab to see how the page is constructed and what is going on behind the scenes. Here is the code of the row selected event to do the trick:
function Row_Selected(webDataGrid, evntArgs) { __doPostBack('<%= UltraChartUpdatePanel.ClientID %>', ''); }
Taz.