Automation Tests using DevExpress Grids with WatiN - devexpress

I am currently using DevExpress grids
and I am now writing automation tests using WatiN, the problem I'm having is
adding and removing columns functionality. I was able to drag and drop the column but does not seem to work, looks like when WatiN talks to the DOM the devexpress javascript methods do not get run.
Anybody been able to get this to work?
Or know a way to add/remove (hide/show) columns in devexpress via javascript?

Unfortunately, we have not tried WatiN and thus, cannot suggest a solution to this problem. However, please note, that the grid is a pure server side control. It means, that its rendering is done on the server. I.e. when you hide / add a new column in the client side, the request(callback) is sent to the server. Anyway, there is a way to hide / show columns using java script using the gridView's client side MoveColumn method. NOTE, this method just sends a callback to the server and thus it will result in a server request. Finally, the complete ASPxGridView client side API is published at:
ASPxClientGridView Members

Related

How do I create a near-real-time, scrolling line graph control in ASPX?

How do I create a scrolling line graph in ASPX?
I have a data feed that is updated every few seconds and I'd like to graph that data and have the chart update automatically. The chart does not need to update in real-time, every 3-5 seconds, maybe even 10 seconds, is sufficient.
I'm not a hard-core web dev but my initial thoughts are to call the service, get the JSON data, and graph it. I'm not sure what out-of-the-box controls are available or how to go about implementing this.
I'm open to using a third party control, if it will make life easier. We have the DevExpress ASP.NET control suite.
something like gRaphaël (http://g.raphaeljs.com/) & a json formatted feed should achieve what you're looking for. Telerik have a pure javascript graphing library that might help, but I can't remember what it's called right now.
Found it! KendoUI http://www.kendoui.com/dataviz.aspx
You can put your chart control inside an updatepanel and can use timers to update it.
There is a very good java script base chart controls. Check HighCharts.
Hope this helps you.
If you are using the DevExpress ASP.NET control suite, you can use the WebChartControl's built-in AJAX functionality. To update your chart you can send a callback to the server and generate the server-side WebChartControl.CustomCallback event via the ASPxClientWebChartControl.PerformCallback client-side method.
This way, you should be able to asynchronously fetch data at server-side using the AJAX-based callback technology an easily implement your own scrolling line graph.
For an example, see the "Highlighted Features - Gantt" ChartsWebDemo module, illustrating this approach in action. Anyway please contact a DevExpress Support Team if you are run into a problem when using this approach. They will be happy to assist you.
Check out the ajax example for Highcharts.Net in the sample project. It does exactly what you are looking to achieve, without you writing a single line of javascript (purely C#)
See also : Live example

Javascript data binding and SEO

I have an application that makes a series of WCF calls that return JSON via JSONP. In turn javascript code will then bind that returned data to HTML controls.
When a bot / spider hits my application, no data would be indexed because javascript would not execute in the bot.
What are some good patterns for dealing with this problem? Ideally I'd like to not have to maintain two sets of data-binding code (one on the server side and one on the client side).
Essentially I need the resulting data to come downstream. Some ideas I had were to.
1) link RSS/ATOM equivalent data
2) a backdoor HTML page
3) an HTML renderer that can execute an ASPX page server side ahead of time and then pass that off to the client
Any guidance would be helpful
Option 3 can I think solve the problem, I will suggest to try this:
Try to see if javascript is enable/bot is browsing the page or not
If it is bot or js is disabled, load the page without web service call and render it with server side code
otherwise go for js version.
I will recommend this if your data is relatively low and the implementation cost is not too high.

Add a new item to html-select list without leaving the page. How?

I've always wondered what is the best way to add a new item to html-select in a website.
Yes, this may sound silly but it is a great problem from the usability perspective. I don't want the user to be taken to a new page every time they need to add new item to a html-select.
I like the way Google Reader and Gmail handle this problem in there "add folder" and "add label" functionality. I would like to mimic that but i have no clue how they did that.
I'm using jQuery, so any reference to plugins, code examples or tutorials are welcome.
I would like it to be as modular as possible so i can reuse it anywhere.
I'm using ASP.NET 3.5 web-forms, Microsoft Access 2003, jQuery, IIS 5 and Win XP Professional as web server.
Thanks.
there's a jquery select plugin that might help you with this. I've manipulated select lists client side and had no problem with subsequent form-submits but you'd need to do some experiments w asp.net
The standard technique of doing this is called ajax, which basically means replacing only parts of the page. JQuery ajax and maybe a tutorial should get you going.
A common mistake for this scenario is to add the item on client (using jQuery or plain javascript). It may look that it works until the next post-back. Unfortunately the Asp.NET post-back model does not allow to alter the controls contents on client side only. So basicaly there are two choices:
Use ajax (the simplest would be to
use an UpdatePanel)
Make a normal
postback to add the item (simple and
fast to code, if performance is not
an issue - for intranet applications
for example)

ASP.NET code inside Google Maps info window

Clarification:
Put simply, I'd like to put an ASP.NET UpdatePanel inside the info window of Google Maps. This would mean that users could interact with my application from within an info window, without refreshing the page and without closing the currently open info window.
Does anyone know if this is possible?
Update:
Thank you to all those who have so far responded. Very much appreciated.
What I have gleaned from the answers is that:
the update panel has it's own "mysterious mechanics" which might be causing the UpdatePanel to not work correctly inside the InfoWindow. Going down the more direct route of using JQuery to make ajax calls to simple web services should eliminate the hidden complexity of the UpdatePanel and enable the functionality I want.
I am still intrigued as to why the UpdatePanel approach does not work, and as to why using one would "break the model" of Google Maps, when surely an UpdatePanel merely renders as HTML and javascript with a link to the XMLHttpRequest object.
Is it possible to place ASP.NET code inside Google Maps info window?
I'd like to place an UpdatePanel with some AJAXified asp:Button's inside the info window.
AFAICT you simply provide the HTML to place in the info window as a string, so was thinking of rendering a UserControl to a string and placing that string in the info window for the browser to render. Does anyone know if this is likely to work?
If this is not possible in Google maps, does anyone have any idea whether such an implementation would be possible with the corresponding Virtual Earth technology?
José Basilio is right. Instead, use $jquery Live Events and put regular HTML in the Info Window then use Ajax calls with jQuery to get the interactivity you want. Reframe the problem.
VirtualEarth has tigether integration with SilverLight, which should mean that you'll have greater .NET control over your web mapping application. With most Google Maps implementations that we've done we typically just use pure HTML/JavaScript/CSS solutions to create AJAX functionality. Thus we would inject HTML/javascript into the InfoWindow class, for any custom functionality that we needed.
Consider another approach and possibly. What you are really looking for is to be able to respond to a server side event. Maybe something like this if you really and truely need to respond to server side events.
http://windyroad.org/2006/07/25/event-driven-ajax-part-1-pushing-server-side-events/
Once you are handling the events on the client in javascript you can do whatever you like to the map
I'm not sure I'd take this approach, but if you want to get ASP.NET code within an info window, you could use an iframe.
Alternatively have you considered an ASP.NET control such as GoogleMap Control, which would handle all the integration for you?
Rich
UpdatePanel != AJAX. Take a look at using jQuery to make Ajax calls ($.ajax) and creating simple web services/etc. to achieve what you're after. While technically you could wiggle an UpdatePanel into there somehow, it just isn't worth it.
Look here for an excellent example on calling AJAX/web methods with jQuery.
Have you looked at the ExtInfoWindow control? Since you did not state your problem, I can't say whether it is a solution, but it seems that it should be mentioned here.

Client side modal dialog in asp.net from the server side code. (how do I do this)

I need a technique for dealing with what seems pretty simple!
I have a form, with some logic on the server side for validation.
if the server side code indicates that there is an issue, I want to display a modal popup to the client.
I am having trouble getting it to work in this way.
I found if I keep all the logic client side, I can use the javascript function
window.showModalDialog("url","title", "style");
However the logic is currently on the server side.
this is an ASP.NET 3.5 web project - is there some way to do this using AJAX controls like the scriptmanager, an update panel etc?
Thank you!
I know that you do it using the ScriptManager control. Basically you just send from the server a line of JavaScript to execute immediately. In this case, the client side line you describe.
Sorry to be vague, but it's almost quitting time and I'll have to grep through a lot of code to find an example.
Here is an example
Beware that modal dialogs are not supported in all browsers.
You may be able to accomplish something similar using DHTML and setting the visibility of divs from the server side if your server side validation fails.
You might also look at Telerik's RadWindow control which was designed (in part) to solve the modal dialog problem.
You need to use an AJAX callback to perform your server side validation and return a response to the client - then decide whether to display the modal dialog... however, why do you need to validate on the server? It is usually best to try and validate in the client to save roundtrips...
You really shouldn't use the modal popuper. First of all it mstly works only in IE. Second of all it's REALLY annoying for your end users...
You should rather use something like e.g. this;Ra-Ajax Clendar Starter-Kit (click the "Create New Activity" in the bottom left corner)

Resources