I'm a beginner to this control, having just replaced an UltraWebGrid with one. In general it's much cleaner and easier to use, but I am stuck because I can't figure out how to accomplish this basic feat:
1) User clicks a row on the WebDataGrid
2) I load new content into a tab control that lives in a WARP panel.
Basically, it's not obvious to me how exactly the new grid causes server-side events to occur. I have the following code in the page code-behind:
protected void gridSearch_RowSelectionChanged(object sender, Infragistics.Web.UI.GridControls.SelectedRowEventArgs e) { string s = "foo"; }
with a breakpoint on the test string assignment. If I click a row on the client, this never gets called. What am I missing? Do I have to handle the client-side event and then call the server? I've been trying stuff for a full day and Googling and all that good stuff, but I'm stuck.
Help is appreciated :-)
The RowSelectionChanged event will only occur after a post back and right now there is no AutoPostBack option.
If you are using an update panel though could you do it using the client-size RowSelectionChanged event?
I'm going to try that, but I'm not sure what I'm trying to do exactly. I've created a Javascript function to catch the RowSelectionChanged event and am trying to figure out how to get the value of the ID cell in the row. Mostly trial and error since I can't seem to find docs for the Javascript events. Once I have that, I somehow want to call a server function(passing that id) which will I hope populate several controls on a Tab control, including an UltraWebGrid.
I'm just a bit confused as to how to get there.
Yes Mr. Shoemaker, that woul be very helpfull. As I asked in this post http://community.infragistics.com/forums/t/52359.aspx I have the same problem. I want to reach the following: The first time a user gets a list of product items. If he selects (clicks) one item, he shoud get a new list with details of the selected item. I got the first list and created colums e.g. image, title, description and additional text. If the user now clicks on one row the next group of items should appear without reloading the whole page but only the grid. I tried to get this working with several approaches. None has worked as I wanted it. Every time I got a complete reload of the page.
Edit: I'm using VisualStudio 2010 and NetAdvantage ASP.NET 10.3 CLR4.x
You could certainly go the route you are suggesting. There are other ways to approach the problem as well. If you like you could simpy call a PageMethod which would use Ajax to call back to the server and the process your request. Are you looking for options, a code sample or something else.
Let me know... I am glad to help.
Craig
If it helps anyone, I got the needed id value this way (vendorId in my case - the first column):
function onSearchRowChanged(sender, eventArgs) { //get the vendor id for the selected row var vendor = eventArgs.getSelectedRows().getItem(0).get_cell(0).get_value(); alert(vendor); }
What you can do is hide the ID of the record in a hidden span in one of the columns. I give an example of how to do this in
Building an Ajax Master/Detail Page with the WebDataGrid
The JavaScript you'll need to locate the proper row index using the selection behavior would be something like this:
function rowChanged(){ var grid = $find("wdg"); var behav = grid.get_behaviors(); var selection = behav.get_selection(); var rows = selection.get_selectedRows(); var row = rows.getItem(0); var index = row.get_index();}