User Profile & Activity

Brad Loveall Member
Page
of 3
Posted: July 22, 2010 4:19 PM

Hi Handy,

I understand why the issue is happening. My questions remains: Is there a way to determine whether or not the InitializePostBack which originates from the user hitting "Reset" is different from a manual column change? I would like to eliminate the user's preferences when the user clicks the Reset and go back to the specs in the .aspx file but since the Reset results in a PostBackAction of "ColumnChange" rather than, say, "Reset," I don't have a way to know when they're resetting.

Thanks,

Brad

Posted: July 22, 2010 9:35 AM

Hi Handy,

We're saving the column preferences in our own xml file that is pretty straightforward, we have the report in question, a list of columns, and whether the user has indicated that they ought to be visible or hidden.

When we load a report, we inspect that file and it overrides whatever might be in the WebGrid column definition on the aspx page. So, we might have eight columns, all of which are designated as visible in our aspx file. But, when the user removes columns and moves them around, their column preferences are changed in the xml file and that is what is used to determine the columns which are loaded.

So, say we have eight columns defined, the user removes two, completes her task and closes her browser. She comes back the next day and when the report is loaded, only six columns are loaded. At this point, if she hits "Reset," she might think that she will get the other two columns back, but she won't. If she removes two more and, in the same session, hits "Reset," then she'll be back to six but she can't get back to eight without manually adding them back. So, what I'm saying is that we'd like to handle the "Reset" postback so that we can eliminate their column preferences altogether but I cannot figure out the difference between a reset call and a normal, manual, column change. Is there some way to determine whether the postback is a reset or if it is just a normal, user, column change?

Thanks,

Brad

Posted: July 21, 2010 11:09 AM

Andi,

I'm curious as to whether this has been fixed. We were able to develop a workaround but it wasn't a trivial issue and, of course, we'd like to be able to use the charts as intended and as your documentation suggests we can. Do you anticipate that this will be resolved?

Thanks,

Brad

Thanks Yudi. I was able to work with this code to achieve my goal here.  You had:

cells.GetNamedItem("Legal").SetText(val, true);
cells.GetNamedItem("Legal").SetText(val);
row.SetDataChanged();
WebGrid1.MarkEdit();

I changed it to:

cells.GetNamedItem("Legal").SetText(val, true);
row.Update();

Using Update() worked a bit better for our situation and I didn't want to call SetText() twice. I wasn't sure if you intended to call it twice for some reason or if it was a mistake but I took out the second call and it worked fine.

Thanks again,

Brad

Thanks Glenn. I was able to get this to work. The key, it seems, is that the addition of columns to the various filter collections needs to take place in PrepareDataBinding. That was the difference.

Thanks,

Brad

Handy,

The columns are ultimately specified; what I meant is that they're not specified in the aspx page but, rather, RetrieveStructure() is used to specify the columns. We have some scenarios where the same WebGrid is used for a couple of different searches and we display the different result sets in the same WebGrid. Then the user is allowed to save their preferences, both their form field entries which generate the results, as well as the field(s) that they sorted on, columns that they filtered on, etc. So, we want our users to be able to load one of the reports that they have saved in this manor, call "RetrieveStructure" and then apply the filters via SortedColumns.Add() but it doesn't seem to work. It doesn't work if I call it before or after RetrieveStructure. Is there a way to accomplish this goal? This same process does work in situations where the columns are added to the grid without RetrieveStructure.

Thanks,

Brad

Posted: June 15, 2010 3:35 PM

Thanks Handy.

Posted: June 1, 2010 9:42 AM

Handy,

I am able to get the checked data key values the following way

            For Each str As String In WebGrid1.RootTable.GetCheckedRows()
                Dim row As WebGridRow = Me.WebGrid1.RootTable.Rows.GetRowByKeyValue(str)
                cList.Add(row.Cells.GetNamedItem("ID").Text.Trim())
            Next

The difference was that I didn't have a DataKeyField on my grid and didn't have PersistRowChecker set to True.

So I am all set now on this one.

Thanks for your help.

Brad

Posted: June 1, 2010 8:54 AM

Handy,

Here are the relevant code snippets

<ISWebGrid:WebGridColumn Name="Fasta" Caption="Fasta" ColumnType="CheckBox" IsRowChecker="true" Bound="false" Width="50" />
Dim al As ArrayList = WebGrid1.RootTable.GetCheckedRows()

So I have a grid with a bunch of data and the first column in the grid is a checkbox column with isRowChecker set to "true." I check two rows and click an <asp:Button instance and in the "Click" event handler for that button, I am trying to get the checked rows. When I call "GetCheckedRows," I get an arraylist of empty strings. It should not be too hard to replicate as there is nothing that I am doing that is out of the ordinary from what I can tell.

Thanks,

Brad

Posted: June 1, 2010 8:36 AM

Handy,

That is close to what we need to do. Basically, based on various conditions related to access rights, roles, etc., we want a certain column to contain one control like, for instance, a dropdownlist or a checkbox, and, in other conditions, we want the column to just contain a label. This is a very common scenario and I would be surprised if this is not possible with the WebGrid. Is this sort of thing available via some other type of column? Perhaps template column is not the right column type? How do you recommend that we accomplish this task?

Thanks,

Brad

All times are GMT -5. The time now is 10:49 PM.
Previous Next