How to put a LinkButton INTO a tooltip using ASP.NET? - c#

When using the core ASP.NET 3.5 (w/ Ajax), is it possible to include a LinkButton in a tooltip?
Unfortunately, these tooltips are generated on-the-fly within a GridView to display custom data from each row. Tooltips are currently showing using jQuery.
So, I don't know how to add a LinkButton (for a "Modify" action) to call a method on code-behind.
Maybe I'm going the wrong way... Any suggestions?
Thank you!

UPDATE : Seems like a Server side control Implementation : http://devarchive.net/advanced-tooltip-control-asp-net-ajax.aspx
There is no direct way to do this. You can find some plugins in JQuery which helps to do this. Try the one #Andre Hühn provided. This one also looks good : http://jquery.bassistance.de/tooltip/demo/

Related

how to handle TextBox.KeyPress event in asp.net using ajax

i want to create a web page with a textbox and a gridview.
as you type in the textbox i want the content of grid view to be retrieved from database according to the text of textbox.
i am also using ajax.
is there any way to get the text from textbox as user types in and pass it to the server side code?
i searched on google but the only thing i got was keypress event using jquery or java and display it using java again. but there was nothing about passing it to the code behind.
Thanks and pardon my poor English :(
In asp.net you can specify the AutoPostBack="true" on a textbox this will fire an postback after you lose focus of that TextBox, so not on every keystrike if you desire to have a postback on every keystrike you will have to implement some javascript knowledge.
Here you can find an example:
How do I make a Textbox Postback on KeyUp?
But I believe you are more interessted in a AutoCompleteBox maybe give this link a try:
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AutoComplete/AutoComplete.aspx
As you said, you can use the java key press event. Then you can create an ajax request and ask the server for data.
You should make sure that the data you are requesting can be retrieved very fast, otherwise you would have a delay when typing. Maybe it's a better approach to fetch the whole result and filter it while typing.
A small example can be found here: Making a Simple Ajax call to controller in asp.net mvc
Other examples can be found with your friend google.com :-)

change listview on button click

I would like to change the listview template on a button click event. for example if your in edittemplate i would like to switch to ItemTemplate.
i am trying to do this because im writing my own custom update function for the list view. so after i successfully update the row, it doesn't switch back to the default view.
Rgds
Adrian
Adrian,
As you have tagged this as an asp.net question I would direct your attention to jquery (jquery.com). If you use a vanilla template (wrapping your elements in simple "div" tags) and use the jquery tools to do addClass/removeClass and toggleClass and apply various css styles to achieve the visual effect you desire you should be able to land just were you wish.
Using page methods you can leverage your custom update on a partial postback from jquery and reduce the server impact.
If you would rather do this server side you are probable looking to leverage the item databound event to set your template.
A more complete answer would require more information about what you are trying to accomplish.
Cheers,
CEC

Divs on an ASP.NET Gridview

The GridView in ASP.NET when rendered isn't the prettiest or most semantic control ever, is there a way to use <div> using constructing it? Or should there be another approach, I ideally would like to remain using the gridview because I select the DataKeyNames in my code, unless there is a similar way to select the DataKeyNames using another control like a listview?
+1 to Lareau. ListView has a DataKeyNames property as well. I would use Ingrid (jQuery) along with a ListView control to make it better.
ListView samples:
http://weblogs.asp.net/scottgu/archive/2008/01/04/jan-4th-links-asp-net-asp-net-ajax-asp-net-mvc-visual-studio-iis7.aspx
http://basgun.wordpress.com/2007/12/29/listview-control-in-aspnet-35-3/
https://web.archive.org/web/20211020153238/https://www.4guysfromrolla.com/articles/122607-1.aspx
https://web.archive.org/web/20210125144848/http://www.4guysfromrolla.com/articles/021308-1.aspx
Download and demo Ingrid:
http://www.reconstrukt.com/ingrid/
You can use repeater instead
I would go with a listView. Similar to a repeater but just a bit better.
The GridView is tabular data. It uses a table to construct it. It's perfectly semantic. I agree it isn't pretty, but a <div> construction of tabular data is just as ugly. The GridView has the greatest functionality for this kind of data display/management.
You might be able to customize the rendering by overriding the Render method of GridView control. This would mean that you are changing the default behaviour of GridView and might need to handle additional events if you decide to do change defaults.
Instead of using the semantics of a div, I would look to format the class using some tailored CSS. Let me know if this is something you're interested in and I can offer you some links.

GridView Editing With Mootools

I've a grid view which has BoundField columns, an Edit link and a Delete link.
For the Edit link, is it possible to call a modal box by MooTools with fields in it?
Note that previous values of the fields are displayed before making an update.
Thanks so much.
How about using jquery or ModalPopupExtender AjaxToolKit control?
Still, you can use the jquery tutorial for your mootools implementation. You can get a good idea from it to do it your own.

ASP dropdownlist city selector

I have an asp dropdownlist loaded with cities/countries. They are loaded directly in code
<asp:ListItem Value="MIA">Miami, Florida</asp:ListItem>
I would like to extend the control with Ajax in order to allow a user to start typing and show similar matching options from a dropdownlist below. Is this possible using this control and the hard coded values? Thanks!
The behaviour you describe is usually achieved by extending the textbox control rather than dropdownlist.
Microsoft has a lot of useful tutorials on its asp.net website; try this one: http://www.asp.net/AJAX/AjaxControlToolkit/Samples/AutoComplete/AutoComplete.aspx for a start.
If you want to write your own control, I have written a blog about some of the gotchas when adding values to a DropDownList via javascript
http://blog.runxc.com/post/2009/04/27/Using-jQuery-to-add-values-to-a-DropDownList-and-overcoming-ASPNET.aspx

Categories

Resources