Showing posts with label extender. Show all posts
Showing posts with label extender. Show all posts

Monday, March 26, 2012

Ajax Toolkit, calendar extender control

I have troubles with calendar control. When I tryed to run site with this control in Visual Studio i see the correct language - russian, but when i tryed to run deployed site using iis, i see english - names of months, days header.

i tryed to write in config files globalisation, ui culture, add charset win-1251, but no differences. i see only english words.

Have you set the EnableScriptGlobalization property to true in the scriptmanager?

yes


Hi

You should specifily its Culture and UICulture. Furture more, you should set ScriptManager's EnableScriptGlobalization and EnableScriptLocalization property to true.

EnableScriptLocalization: http://www.asp.net/AJAX/Documentation/Live/mref/P_System_Web_UI_ScriptManager_EnableScriptLocalization.aspx

EnableScriptGlobalization: http://www.asp.net/AJAX/Documentation/Live/mref/P_System_Web_UI_ScriptManager_EnableScriptGlobalization.aspx

Here is the sample.

<%@. Page Language="C#" Culture="ru-RU" UICulture="ru"%><%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"></script><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" EnableScriptGlobalization="true" EnableScriptLocalization="true" > </asp:ScriptManager> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><asp:Button ID="Button2" runat="server" Text="hide" OnClientClick="return hideCalendar()"/> <asp:Button ID="Button1" runat="server" Text="show" OnClientClick="return false;"/> <ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox1" PopupButtonID="Button1" > </ajaxToolkit:CalendarExtender> </form></body></html>

I hope this help.

Best regards,

Jonathan

AJAX Toolkit Modal Popup Extender - Display Issue

I have a site that is using a master page. Within the master page is a div that has a style sheet entry setting the position to absolute. The content div is within this div. My problem is that when the modal popup is displayed and the user has the screen resolution is set to 800X600 the bottom of the modal popup is off of the screen and as the user scrolls down the page the modal dialog moves along with the scrolling keeping the bottom of the dialog off of the page. I tried setting the X/Y parameters for this but as the user scrolls the dialog box still moves, keeping part of it off of the viewable area of the screen. I remove the position absolute setting in the style sheet for the parent div and this issue does not occur, but, my screen is not displayed correctly. This is using IE6. Any ideas?

Thank You for any help.

Actually I was incorrect. It was not the position=absolute causing the error. It was the top=167px that is causing the error. Top is not applied if the position is not specified. That is the root cause of the issue. Please reply if you have a solution.

Ajax toolkit dragdropmanager

Hello, I'm using Ajax toolkit in my project.

I have written own extender for drag and drop procedure.

Everything is fine, except that images that is located in target control doesn't fire onlick event.

Seems like, dragdropmanager disable this event on page load. Any workarounds?

thanks in advance.

Hi,

the DragDropManager doesn't disable any events of DOM elements. Could you explain in more detail your scenario? Are the images the draggable items?

Ajax Toolkit - context key

What is this context key in slideshow extender and how to use it

Hi FutureGuru,

Please visit the example site, or set it up yourself ...http://www.asp.net/AJAX/Control-Toolkit/Live/SlideShow/SlideShow.aspx

They explain it allWink

ContextKey - User/page specific context provided to an optional overload of the web method described by ServiceMethod/ServicePath. If the context key is used, it should have the same signature with an additional parameter named contextKey of type string:
 [System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public AjaxControlToolkit.Slide[] GetSlides(string contextKey) { ... }
Note that you can replace "GetSlides" with a name of your choice, but the return type and parameter name and type must exactly match, including case.

Saturday, March 24, 2012

AJAX Textbox Extender

I'm using an AJAX textbox extender to present a masked textbox for the entry of Social Security numbers to the user. When the user tabs into it, it displays the mask and formats the data as it's entered, both of which are expected actions; however, when the user tabs away from the control to another control on the form, the formatting disappears and all that's displayed is the string of nine digits for the SSN.

Is there a way to force it to continue displaying the formatted SSN?

Doesn't anyone know the answer to my question?


Have you tried setting the ClearMaskOnLostFocus property to false? I think that should work for you, but if you access the .text property of the textbox, the mask characters will be in the string.

Hope that helps!

Wednesday, March 21, 2012

ajax SlideShowExtender

Working with Ajax slideshowextender, really nice work from ajax-group!

Just have a litte prob, and that is that I want the extender to rebind data from database, (ie .init) (force the extender to reload) when I have updated image-name or image-description in database-record.
I dont want to postback the entire page, because my extender is in a webpart.

Anyone have a suggestion how to do??

I am not sure if it is possible to have this without a postback. However, you can stick the extender inside an update panel and that should allow you refresh the slide show without causing the entire page to be re-rendered. You will not be able to have a webpart inside an update panel though. It is notsupported.


UpdatePanel fixed my problem, just after I posted the first post...but tnx for confirming!

AJAX SlideShow Extender error

Hey, I have a SlideShow Extender into a Webform with Visual Basic and this doesn't show the pictures via WebMethod, only the first picture witch I inicializated. I let you know my code:

<asp:Image ID="Image1" runat="server"
Height="200"
Style="border: 1px solid black;width:auto"
ImageUrl="~/images/DSC02489.JPG"
AlternateText="Desfile Sambil Valencia" /> <br />
<asp:Label runat="Server" ID="imageLabel1"/><br />
<asp:ImageButton ID="prevButton" runat="server" ImageUrl="~/images/previous_20_1.gif" />
<asp:ImageButton ID="playButton" runat="server" ImageUrl="~/images/play_30_1.gif" />
<asp:ImageButton ID="nextButton" runat="server" ImageUrl="~/images/next_20_1.gif" />
<ajaxToolkit:SlideShowExtender ID="SlideShowExtender1" runat="server"
TargetControlID="Image1"
SlideShowServiceMethod=GetSlides()
AutoPlay="true"
ImageDescriptionLabelID="imageLabel1"
NextButtonID="nextButton"
PlayButtonText="Play"
StopButtonText="Stop"
PreviousButtonID="prevButton"
PlayButtonID="playButton"
Loop="true" />

and the script...

<script runat="server" type="text/VB">
<System.Web.Services.WebMethod()> _
<System.Web.Script.Services.ScriptMethod()> _
Public Shared Function GetSlides() As AjaxControlToolkit.Slide()
Return New AjaxControlToolkit.Slide() {New AjaxControlToolkit.Slide("~Images/DSC02489.JPG", "Desfile Febrero Sambil", "Desfile Febrero Sambil"), New AjaxControlToolkit.Slide("~Images/DSC02489.JPG", "Desfile Febrero Sambil", "Desfile Febrero Sambil")}
End Function
</script>

and the Internet Explorar error is as follow>

Line: 79

Char: 1

Error: 'this._slides[...].ImagePath' is null or not an object

Please... Can Someone tell me how I doing it a best-use...

Please set the method name as a string

SlideShowServiceMethod="GetSlides"

*not* SlideShowServiceMethod=GetSlides() .

Check out the sample athttp://ajax.asp.net/ajaxtoolkit/SlideShow/SlideShow.aspx.


Ok, it's working like sample now, but I really need to use a webmethod that allow obtain photos from a diferent source. I mean, internally I can to set the webmethod to read a database and locate photo source but my problem is when it's required that WebMethod "knows" what is the data source to query because I can't to pass parameters? or Can I?

Thank you in advance


After hours figthing with this code I found a solution to my need...

I was needing pass a parameter to the WebService to retrieve values (Pictures Names) from a database. At the moment, I couldn't do this (Anyone can to make me a correction). So, I tried to use a Application Variable (Applicationstate) named Id (my Parameter) and my Webservice could read it and this worked to retrieve the specific Pictures Collection taht I wished...

This is the code:

WebService:

1<%@. WebService Language="VB"Class="SlideShowPictures" %>23Imports System.Web4Imports System.Web.Services5Imports System.Web.Services.Protocols6Imports System.Data7Imports System.Data.SqlClient8Imports System.Web.Profile9Imports System.Web.HttpRequest1011<WebService(Namespace:="http://tempuri.org/")> _12<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _13<Script.Services.ScriptService()> _14Public Class SlideShowPictures15Inherits System.Web.Services.WebService16Public img1As String17 Public img2As String18 Public img3As String19 Public img4As String2021 <System.Web.Script.Services.ScriptMethod()> _22 <System.Web.Services.WebMethod()> _23Public Function GetSlides()As AjaxControlToolkit.Slide()24 ReadPhotoNews()2526Return New AjaxControlToolkit.Slide() {New AjaxControlToolkit.Slide(img1,"News01","Photo01"),New AjaxControlToolkit.Slide(img2,"News2","Photo02"),New AjaxControlToolkit.Slide(img3,"News03","Photo03"),New AjaxControlToolkit.Slide(img4,"News4","Photo04")}2728End Function2930 Public Sub ReadPhotoNews()31Dim idAs Integer =CInt(Me.Context.Application("id"))32Dim rstQueryAs SqlDataReader = MyNameSpace.News.ReadNews(id)33If rstQuery.Read()Then34 img1 = IIf(IsDBNull(rstQuery.GetValue(4)),"", rstQuery.GetValue(4))35 img2 = IIf(IsDBNull(rstQuery.GetValue(5)),"", rstQuery.GetValue(5))36 img3 = IIf(IsDBNull(rstQuery.GetValue(6)),"", rstQuery.GetValue(6))37 img4 = IIf(IsDBNull(rstQuery.GetValue(7)),"", rstQuery.GetValue(7))38End If39 End Sub

ASP.aspx file:

<asp:Image ID="Image1" runat="server"
Height="200"
Style="border: 1px solid black;width:auto" />
<br />
<asp:ImageButton ID="prevButton" runat="server" ImageUrl="images/previous_20_1.gif" />
<asp:ImageButton ID="playButton" runat="server" ImageUrl="images/play_30_1.gif" />
<asp:ImageButton ID="nextButton" runat="server" ImageUrl="images/next_20_1.gif" />
<ajaxToolkit:SlideShowExtender ID="SlideShowExtender1" runat="server"
TargetControlID="Image1"
SlideShowServiceMethod="GetSlides"
SlideShowServicePath="SlideShowPictures.asmx"
AutoPlay="true"
NextButtonID="nextButton"
PlayButtonText="Play"
StopButtonText="Stop"
PreviousButtonID="prevButton"
PlayButtonID="playButton"
Loop="true" />

ASP.aspx.vb File:


Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Application("id") = Request.QueryString("Id")
End Sub



Yes. This is a workaround expected, that you wrap your call inside a method whose signature and param names match up what is passed to the slideshow extender. Although, we would like to improve it. Seebug. All extenders in the toolkit that take in webservice and webmethod as parameters need to be more flexible and we plan to fix that.

Using c#, i am beginning to realize that it is not possible to persist an application variable (or even a session variable) and be able to access it from a static context (from the webmethod GetSlides() that is).

I am hitting my head on the keyboard right now.

Do you perhaps know a workaround in order to be able to pass a variable (originally obtained from "Request" in the same Page's onLoad() ) in the webmethod?


This worked for me

in page load I tack on AlbumID to the SlideShowServiceMethod

protectedvoid Page_Load(object sender,EventArgs e) {

SlideShowExt1.SlideShowServiceMethod ="GetSlides?AlbumID=" + Request.QueryString["AlbumID"];

}

Then in GetSlides() get the string out of the request

[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static AjaxControlToolkit.Slide[] GetSlides()
{
int AlbumID = int.Parse(HttpContext.Current.Request.QueryString["AlbumID"]);

//gel a list of photos from the album
System.Collections.Generic.List<Photo> photos = PhotoManager.GetPhotos(AlbumID);

// copy relevant data to slides array
AjaxControlToolkit.Slide[] slides = new AjaxControlToolkit.Slide[photos.Count];

int i = 0;

foreach (Photo p in photos)
{
AjaxControlToolkit.Slide slide = new AjaxControlToolkit.Slide();

// must be relative path
slide.ImagePath = "images\\" + p.Location;
slide.Name = p.Caption;
slide.Description = p.Caption;

slides[i] = slide;
i++;
}
return slides;
}


We (Ted one of the Toolkit developers made this change yesterday) have added support to now pass additional data to webservices used by AutoComplete, CascadingDropDown, NumericUpDown and SlideShow so you will no longer need this workaround. You can download the latest source code and build the Toolkit dll and try it out. The demo pages have been updated in the Sample Website as well. Take a look at the manual tests added by Ted that demonstrate the usage. This should be part of the next official Toolkit release around end of this month.

Can somebody post the sample code how this additional parameter could be used in this xample with AlbumID? I looked at the source, but it is confusing. The sample is very limited, jsut describes what context key is for. It would be great to have full sample like that..


The AutoComplete example shows how to pass context pretty well (AutoCompleteWithContext.aspx).

But I think you may have discovered an inherent bug in slideshow.

The function_slideShowInitshould be "public" i.e. it should not start with an underscore so that after the contextkey parameter is changed the slideshow reinvokes the xmlhttprequest to get new data. This could also and actually should also be done by a handler when contextkey is updated or other information about the slideshow is updated (I will need to look into this further). Currently the only time slideshow queries the webservice is onload so even setting the contextkey in pageLoad is too late because it is already completely initialized by then.


The error that some people report about the 'webmethod not found' can be avoided by being sure to set the WebMethod used to a static function. The ajax docs example in the Sample Website leaves that out, and it won't work without it.


I have openedWorkItemId=11887 to track this issue.