maintain scrollposition in Coolgridview - asp.net

I have an asp 3.5 site that communicates with an Oacle DB. I put a CoolGridView on it that binds some object and when users click a CheckBox I fill in a textbox on that row with some data.
However, the scrollbar behaves weird, sometimes it jumps to the top sometimes to the bottom whenever I select anything and creates a postback.
Is there an easy way to avoid this? Some hidden property I never noticed?
And yes, I have the maintainScrollPositionOnPostBack set, I read somewhere that I need to have my CoolGridView in an UpdatePanel. Well I don't, never used them, seem that I need to rewrite the whole Grid if I change this?
But maybe I have to?
Regards

I think I got it working, wrapping only the GridView in an updatepanel and throwing in a ScriptManager sem to have solved it..

Related

Update Panel inside of a repeater

I have a repeater that houses a gridview. That gridview needs to be editable, and to make for a more fluid experience, I have the gridview wrapped with an update panel. There are n number of update panels on the page based on this. Everything is working perfectly fine, but I'm asking because I'm afraid of problems that may arise, such as postback size. Is this the best way to do this? Are there any pitfalls I'm not seeing?
You have an eligible concern.
First thing to know if that UpdatePanel post the whole page to the server, always, even including whole ViewState content. Nothing you can do about it, just make sure you acknowledge that. So if your page is very large and you notice significant lags in how the app works, you might want to consider a different approach, perhaps with manual async calls, or something like that.
Second thing immediately follows - whenever an UpdatePanel does a postback, server does the full page life cycle, and then just a part inside the UpdatePanel is updated on the page. Again, nothing you can or should do, this is just how UpdatePanel works. People are sometimes surprised by that fact while debugging, so it was worth mentioning.
Third thing is specific for your case, cause you have multiple UpdatePanels on the page. By default if one of them does a postback, all other panels do a postback as well, and consequently they all are updated. Maybe this is a desired behavior, maybe not. If not, you can set UpdateMode property of each UpdatePanel to Conditional, and they will be update only GridView inside triggers an update. More on this here.
These and much more other details on UpdatePanels, can be found in this article.

ASP.NET how to pass a reference to a particular control

I'm generally an ASP.NET MVC guy, so the "standard" ASP.NET stuff is a little difficult for me to wrap my brain around. I've tried looking for the answer, but the keywords I'm using seem to be too generic... I get a lot of close answers, but not what I'm actually looking for.
I have a grid that is populated from a data set. One of the fields is a dropdown with 4 possible statuses. When the user selects a status, an event is fired in the codebehind to make the change in the db immediately.
There is a particular status that I need to confirm, because once it's selected, it's irreversible. Figuring out how to have the back end pop up a confirmation box was annoying, but I think I have that part done now.
The problem is, if the user confirms that the status they selected for the dropdown was intended, I need to disable any further changes to that dropdown, either by disabling the control or by removing the row altogether. With this requirement, I imagine I need to pass a reference to the specific control that fired the event back to the script, so that it can pass it through the postback, where I would need to consume it.
I have no idea how to pass a reference to the control (what can be used as a reference?) and I have no idea how to use that reference in the postback.
Any help would be greatly appreciated.
;p i was waiting for you to find my post on the issue lol.
but to put it simply, you postback to the page, all members are still available to you if you instantiated something in codebehind. if not, then use FindControl to pull them from DOM. here's the passing values stuff.
as long as you don't kill the lifecycle, you're fine: Passing dropdownlist selected value to another page's dropdown list
and here is the linkspam (full docs): How do I keep TCP/IP socket open in IIS?
probably the articles on session-state and page lifecycle will be of most use.
To prompt the user for confirm add this attribute to dropdownlist.
onchange="return confirm('Confirmation Message');"

On Updatepanel update, everything outside the updatepanel disappears

Apologies for such a broad, sweeping question, but I can't really give specific code examples because as far as I can tell from research this problem is unique to the particular page I'm working on and if I knew what to do to replicate it then I'd most likely be able to fix it.
I have an asp.net vb (v3.5 using the ajaxcontroltoolkit v4) page essentially binding some straight forward SQL database data to a gridview.
The gridview's in an update panel and whenever I do anything that causes a postback inside the update panel, everything outside the update panel vanishes. The update panel IS updating correclty.
There's no conditional updating, just an 'out of the box' update panel.
All other ajax functionality is working correctly, such as filtered textbox extenders and validation with callout extenders, so I don't think it's a basic script reference error.
I'm making use of javascript and jquery to modify controls on the fly that are within the updatepanel.
It was a standalone page for development but for testing this problem I put it into a contentplaceholder on a masterpage. Now on updating, everything else in the contentplaceholder disappears, leaving the masterpages header etc present.
If you haven't come across this particular problem before, can you think of how I could go about debugging it?
If you have any ideas at all, it might be enough to set me down the right path.
Many thanks.
Thanks for taking the time to make suggestions Mt. Schneiders.
In the end...haha wow, embarrassing... I've been doing this for the best part of 6 years now and I was closing my updatepanel before closing a div that started above the panel.
Simple fix. Yay! Thanks again.

CSS Dropping For Certain Controls

We have a pretty complex application design with a bunch of telerik controls. Every now and then, we get issues where the associated CSS to a file are lost, and the controls are not styled. So for instance, after an async postback (a couple of postbacks into the life of the page), the CSS for the textbox, date picker, combo, and other controls are lost. It's not complete; some controls still appear as they normally do, I don't think it's all inclusive.
Any idea why and how I can debug, and determine why they get lost? Anything I can do to work around it?
Thanks.
Brian
Have you tried the RadStyleSheetManager?
RadStyleSheetManager can help, but statically defining the CSS is the solution to this weird problem. RadStylesheetManager also gets references to the control dynamically and would have the same problem.

Telerik RadComboBox in a RadGrid Client Side Validation

I'm using the Telerik ASP.net control suite (2008 Q3 I believe, can't upgrade yet). I've got a radcombobox in a Radgrid control (in a GridTemplateColumn's Edit template). If functions ok, but I've got some client side validation on other controls on the grid (that appear to be working without errors). For some reason after the client side validation happens, the combo box stops functioning. No visible js errors, the thing just dies.
Anyone seen this and have fix? Google has failed me.
Thanks for your help.
Ok, I solved it. Very cludgy work around.
First, I've got a panel outside of the multiviewpanel that holds my grid with another similar Radcombobox that also died on validation. I started thinking, what if I did some sort of post back, would that fix things for some reason? So in my grid I added a custom validator that validates the RadComboBox in my grid. It calls a javascript validation method like so...
function valCOMBO(o, a) {
a.IsValid = true;
setTimeout(Res, 500);
}
function Res() { __doPostBack("<%=OPCOCombo.UniqueID %>");}
Note, since this field isn't required to be filled in by the user, I always return is valid is true. Here is where the quasi magic happens. I make a post back on the OTHER RadComboBox in the top panel outside the grid in javascript. The top out of grid RadComboBox has its autopostback set to true, don't know if that is necessary if you try this example.
It worked. All of a sudden both RadComboBoxes, both the one in the grid and the one above it started working again. But I noticed the value would be lost in the grid's RadComboBox sometimes, so for giggles I added the slight pause before doing the post back of 500 ms. That did the trick. It actually would work with a very small pause, but I increased it to 500 ms for a saftey margin incase an end user was on a slow connection and that might matter.
Cluggy, cluggy, cluggy. I wish I could have just used jQuery, and used an alternative to these freaking telerik radcomboboxes, but such is life (I hear a limited version of jQuery is burried in Telerik, will experiment with that on later releases). What sucks is I bet the latest release of Telerik fixes this problem (it better), so all this poking around will end up being unnecessary when we upgrade (can't yet, some conflict with some of the customized controls that we build inheriting off of Telerik. Jan Q1 2009+ break those controls :( )
Hope this might help someone.
Another option. I ran into a scenario where I had to use lots of RadComboboxes so rather then worry about validating their contents, I just added text fields with a button next to each one that would open a radwindow with a RadComboBox so values could be chosen dynamically. On select javascript passed the selectedvalue back to the target element on the window opener page. I ran into a few headaches that I had to work though with having a bunch of context parameters set in javascript before calling the webservice on each key up (hint: with IE set the height of Radcombobox at least for 2008 Telerik versions...if you don't you will start having freezes).
Again, hope this idea is useful.

Resources