jqGrid - multiselect rows and rowselect - asp.net

I have a jqGrid with multi select set to true using the asp.net jqGrid.
I want it to select multipole rows then click a button and something will apply to the IDs for all those rows. At the same time, clicking on a row should populate some fields (ex. textboxes). The problem is I've used the rowselect method and although that allows me to populate the form on row select it does not allow me to select multiple checkbox rows.
Is there a way to make the checkboxes not activate the rowselect method?
OR is the alternative to create a hyperlink on the result of the value in a cell that calls a method in code behind passing the ID? Is my last idea even possible?
Thanks

In order for checkboxes not to activate the rowselect event , you can use cellselect instead of rowselect function. Under cellselect function , check for column index if its not the checkbox column , then execute the code which you have written for rowselect.

You may need to write client side code [javascript] , you can add
tag [server] and add cellselect option to it . For more information check the link below
http://www.trirand.net/forum/default.aspx?g=posts&t=1452

Related

How to show all items in Listbox that is linked to dropdown

In an Access Userform I have a listbox that is linked to a dropdown field. In the dropdown field the user can choose a country, and the listbox then updates and shows only the records that are relevant to that country.
I have described how I get the listbox to filter based on the selection in the dropdown in this question here.
While I managed to solve one problem there I created another.
Now when I open the form, the listbox is empty instead of showing all records.
My question: How can I show all records in the listbox to begin with and THEN have the user filter the list based on the dropdown?
The SQL Code in the LIstbox is now the following:
SELECT tblFUNDS.MorningsStar_Fund_Name, tblFUNDS.ISIN, tblFUNDS.RDR, tblISIN_Country_Table.Country
FROM tblFUNDS INNER JOIN tblISIN_Country_Table ON tblFUNDS.ISIN = tblISIN_Country_Table.ISIN
GROUP BY tblFUNDS.MorningsStar_Fund_Name, tblFUNDS.ISIN, tblFUNDS.RDR, tblISIN_Country_Table.Country, tblFUNDS.Fund_Selection
HAVING (((tblISIN_Country_Table.Country)=[Forms]![frmMain]![ddnCountry].[Text]) AND ((tblFUNDS.Fund_Selection)=0));
So I ended up solving this one as well... with a bit of help from an online article which I can now no longer find unfortunately (otherwise I would reference it here):
SELECT tblFUNDS.MorningsStar_Fund_Name, tblFUNDS.ISIN, tblFUNDS.RDR, tblISIN_Country_Table.Country
FROM tblFUNDS INNER JOIN tblISIN_Country_Table ON tblFUNDS.ISIN = tblISIN_Country_Table.ISIN
GROUP BY tblFUNDS.MorningsStar_Fund_Name, tblFUNDS.ISIN, tblFUNDS.RDR, tblISIN_Country_Table.Country, tblFUNDS.Fund_Selection
HAVING (((tblISIN_Country_Table.Country) Like Nz([Forms]![frmMain]![ddnCountry].[Text],'*')) AND ((tblFUNDS.Fund_Selection)=0));
The important part is this...
Like Nz([Forms]![frmMain]![ddnCountry].[Text],'*')) AND ((tblFUNDS.Fund_Selection)=0));
Essentially the Nz function lets you return a value when a variant is null. I had it return * which ofcourse is the SQL equivalent of Return All.

Refresh drop down list

I have a drop down list that is populated based on the selected value of another drop down list. The main drop down list is dlJobName. It contains the list of all active jobs. The second drop down list is dlStage. This contains the distinct stage values related to the JobName. Here is the query that populates the dlStage drop down list.
SELECT DISTINCT [AnnotationDate] as Annotation_Date FROM [vw_GridviewSource] WHERE ([Name] = #Name)
In this code the AnnotationDate is not a date field but a text field. #Name is a variable equal to the selected value from the dlJobName list.
Here is my dilemma. When I make a selected_index_change event for the dlJobName, before I update the gridview that uses both of these drop down lists, I need to update the dlStage to only available values. What is happening is the dlStage list is not updated and the values in the drop down list is not available for the new JobName. Is there a way to force the query to run on the dlStage drop down list in conjunction with the selected index change event? This would cause the gridview to at least populate and not error out.
I can provide whatever additional code is necessary.
I think you have not set AutoPostBack="true" of drop down list. If Problem continues please put your HTML and cs code for proper help.
Hi maybe like other user comment you need go to property from dropdownlist, search AutoPostBack and change False for True. Don't forget clean firsr your dropdownlist
DropDownList.Items.Clear() (VB.NET)
DropDownList.Items.Clear(); (C#)
After clean your dropdownlist charge again your method to bind dropdownlist
set the property
dlJobName.AutoPostBack="true"
This will makes the SelectedIndexEvent to fired when the selected index of the main dropdown is changed.
In that selectedIndexChanged Event load the second DropdownList.
Here is an example,
http://asp-net-example.blogspot.in/2009/03/how-to-use-dropdownlist-autopostback.html
Hope your problem solved, if still exists kindly paste your snippet.

Checkboxes and View Based Table View

I am having some difficulty trying to use checkboxes as the selectedIndex in a view based table.
There is good documentation on view based table here:
[View Based Tables ]
However, I after searching and looking on Stackoverflow I can't seem to get my implementation for doing the following.
My view is a table that makes a callout to Yahoo Finance. The table is view based constructed with bindings.
When the table is populated I want to have a check box against each row so that when the user clicks the check box, that row will be updated from Yahoo. Currently this works using multi or single selection using the table view and an observer.. I want to do this with the checkboxes and a button that gets all the checked rows.
The IB setup is as follows:
What is the best way to get the rows where the checkbox is selected? Should I use the array controller or do I need to do something with the table?
Assuming that you use a NSArray of NSDictionaries as your data model, why not add a key/value pair to each "stock" dictionary as a flag? Then in your button action method, just iterate through the data model and trigger an update when the flag is set. Bindings do the rest!

Expand/Collapse GridView rows of the same type

I have a gridview with some boundfields and templatefields. My data are sales Unit-Price-Store, right now the user selects a store (from a DropDownList) and the Grid is all Unit-Price for that store.
Is there a way to make put a button next to each unit so that when the user clicks it, that row expands to include a new row for each store? IE, when I'm looking at Store 1 and I click the button I also get to see Unit-Price info for Stores 2,3,4 (but just for this item)?
I used jQuery. Basically, I tagged that column and then did an each statement. If value.innerHTML != Store $(this).closest('tr').hide(); Else assign it a function on click that looks at all 'tr' where Unit matches but Store doesn't and slideToggle()

Get Changed Rows of GridView ASP.Net

How Can I find all the rows that has been changed in gridview. I can not use Ajax in any form
First get the contents of your grid before it was changed (such as caching the results of the original gridview datasource binding). Then go through the dataset/datatable/however you want to store it, and compare the contents with the current rows of the gridview.
There's no real efficient way to do this, no method like GridView.GetAllChangedRows(). So, what you might do instead is keep a behind the scenes List that you add to each time a row is modified (use the RowUpdated method), then clear this list when needed.
It depends upon how many columns you want to edit in a row.
If you have only one editable column in a row then you can associate a javascript method with that control which you want to modify and in that method you can get a rowid which you can save in another hidden field and in server side you can get all rows whose ids are stored in hidden field.
If you have whole row editable in that case the best approach I think you should save the original data source somewhere and also set a javascript method with rowclick event to get rowid which user selects. Then when user clicks on submit button get all rows whose row ids are stored in hidden field then compare those with same rowid in datasource. This is the best approach from my point of you.
Let me give you an example, suppose there are 1000 rows in a grid and user clicks on only 180 rows. In that case we will compare only 180 rows and wont compare rest of the rows.
Please let me know if somebody has better idea then this.

Resources