jquery Ui Auto Complete Static ServerSide Data source - asp.net

jquery Ui AutoComplete has a property that named Source.
i want to value this property with static datasource for example generic list or filled dataset on my asp.net application.
is it possible?
would you please give me an example?
thanks.

There's a perfectly good example on the demo page
Go to http://jqueryui.com/demos/autocomplete/#options
Expand the "source" example
Edit: Actually, the default example source is even better.
Go to http://jqueryui.com/demos/autocomplete/
Click the "View Source" link under the demo

Related

What is "Post on Changes" or "Reflection" functionality?

I am new to CC Guidewire. I didnt understand what post on change will do?
Thanks.
The "postOnChange" attribute on a PCF UI element can either be true or false.
If it is true then everytime that UI field is changed by a user; it will POST back to the server.
The server will then execute the code in corresponding UI elements "onChange" attribute.
These together basically allows you to add a piece of code that will fire when that UI field is been changed on screen by the user.
The reflection items can be used to use AJAX style updates to multiple fields on the basis of others. It is a bit more complex to use and understand.

How navigate to next page using AJAX in MVC4?

I don't have so much experience using AJAX in a MVC application, in fact is my first facing. Please check the below image and note the rectangles.
The image is just an example that I took from internet.
The biggest rectangle is a partial view in my application and I have to render it when the user press Continue or Continuar button. The application should replace the current view for another without refresh the page.
This is the code which I'm testing, note first that I'm passing the first element of a list, but when the user press the button, render the view with the next element index = 2.
public ActionResult DoTest()
{
if (!Request.IsAjaxRequest())
{ }
List<Worksheet> worksheets = new List<Worksheet>()
{
new Worksheet("Hoja 1", ...),
new Worksheet("Hoja 2", ...)
};
return View(worksheets[0]);
}
Can orient me a little bit to know how to implement this feature? I just know that I need to use Ajax.
Have a look through the tutorials and examples here. There's plenty of other material around on the web with information on this subject.
There are many different ways you can achieve this. One way would be to write a custom paging Helper (HtmlHelper) that accepts new content upon the post event. You can view all about Helpers here : Custom HTML Helpers
Another way could be to use partial page rendering to achieve the partial page update upon post event.
If I was you I would combine a partial view with a jquery function to update the content. You can view some help on that here: Change dive content with Jquery

How to click on Toolbar element with Sahi for Test Automation?

Web page contain a button with some text for example "Test". This button actually is a toolbar element. (class ="tbButton" id="id",text="Test") and redirects to a certain table when press on it.
When I tried to use the following click methods, the button did not react.
browser.div("Test").click();
browser.click("id");
browser.click("");
browser.div("id").click();
browser.byId("id").click();
browser.containsText(browser.byId("id"),"Test");
browser.div("Test").in(browser.table("Generar")).click();
browser.byXPath("//div/Test").click();
Could anybody suggest me an alternative methods that is able to resolve the above problem?
Try with:
browser.xy(browser.div("Test"), 10, 10).click();
This will click a little inside the div.

Is there a way for MVC Partial View retrieved using jQuery to keep UI CSS Styling?

I have an MVC 2 project, consisting of a MasterPageView a child View called Index and a number of PartialViews. The PartialViews are loaded into the Index View using the jQuery Ajax method $.get(....).
My problem is that I am styling the buttons using jQuery UI like:
$('button').button();
but I find that I need to do this on every PartialView. What I would like to do is define
this once in the MasterPageView, but if I do this the styling is lost. I'm guessing this
is because the styling is applied before the DOM is loaded, is this correct? Is there any
way to implement this i.e. just define it on the MasterPageView?
Thanks for the help !
This wont work when objects are added to the DOM after the initial load. In those cases you should go for the new .live() syntax in jQuery :
$("button").live("load", function(){
$(this).button();
});
It listens for new objects being added to the DOM and attaches an eventhandler to it..
Hope that helps!

creating help for asp.net website

My requirement is to have database based help system for asp.net website, as shown in the image below. i have searched web but could not find even remotely related solution.
DNN Help System http://img3.imageshack.us/img3/6720/dnnhelpimage20091125.jpg
You could assign each help item a unique ID (perhaps GUID to make it easier to generate by the developer enabling help for that item).
Clicking on the link opens a dialog, tooltip, new window, whatever. Just have the UI load the help text by ID from the database.
To make this easier to implement in the UI, there are a few ways. Perhaps you can create a jQuery client-side behavior.
your HTML would look something like:
<span class="help" id="#{unique-id-here}">Admin</admin>
and you could have jQuery on DOM load:
$(function() {
var help = $(".help");
help.prepend("<img src=\"path/to/images/help.png\" />");
help.click(function() {
//do something with this.id; open a popup, a title bar, whatever.
}
});
We did it on our site by doing the following:
We have a HelpTopics database with a HelpTopicId and HelpTopicText
We create an aspx page that displays the HelpTopicText based on the HelptopicId passed in the querystring.
We set up a css class for the A tag that displays the link to the help with the question mark image.
We created a UserControl named TitleandHelp that contained a link to the page mentioned in step 2 and the style for the link set to step 3 above: The usercontrol has a public rpoperty for the title and one for the topicID (We called it HelpContext).
We add the usercontrol to the aspx page where appropriate
<uc2:titleandhelp ID="titleandhelp1" runat="server" HelpContext="4" PageTitle="Forgot Password" />
it may sound like a lot of work, but really it only takes a half hour or so to do all of the setup. The rest of the work lies in populating the table and dragging the usercontrol onto the pages where appropriate.

Resources