Showing posts with label errors. Show all posts
Showing posts with label errors. Show all posts

Wednesday, March 28, 2012

Ajax UpdatePanel does not return MS-SQL errors??

I have a datagrid wrapped in an UpdatePanel. When I try adding or editing a row that violates a check constraint, I recieve the ridiculous Sys.WebForms.PageRequestManagerPerserErrorException: the message received from the server could not parsed... instead of the MS-SQLL error message.

Is there a way to rectify this behaviour?

TIA

Hi,

Please refer to this for the reason of the error:

http://siderite.blogspot.com/2007/02/aspnet-ajax-and-responsewrite-or.html

Hope this helps.

NOTE:This response contains a reference to a third partyWorld Wide Web site. Microsoft is providing this information as a convenienceto you. Microsoft does not control these sites and has not tested any softwareor information found on these sites; therefore, Microsoft cannot make anyrepresentations regarding the quality, safety, or suitability of any softwareor information found there. There are inherent dangers in the use of anysoftware found on the Internet, and Microsoft cautions you to make sure thatyou completely understand the risk before retrieving any software from theInternet.


I'm not sure about what is the inner problem of your application.
But I also face this kind of problem - 'Sys.WebForms.PageRequestManagerPerserErrorException:'. So far I
understand this happen when there is some unrecongnize html render or event occurs. I'm also not very clear.
But I solve the issue by set the attribute EnableEventValidation="false" in the ASPX page, where I place my UpdatePanel.Thanks
I'm not sure about what is the inner problem of your application.

But I also face this kind of problem - 'Sys.WebForms.PageRequestManagerPerserErrorException:'. So far I
understand this happen when there is some unrecongnize html render or event occurs. I'm also not very clear.

But I solve the issue by set the attribute EnableEventValidation="false" in the ASPX page, where I place my UpdatePanel.

Thanks

Thanks Raymond,

Yep. You can't write to the response stream when using AJAX.


Here is one more link

http://weblogs.asp.net/leftslipper/archive/2007/02/26/sys-webforms-pagerequestmanagerparsererrorexception-what-it-is-and-how-to-avoid-it.aspx

Monday, March 26, 2012

AJAX Toolkit errors

Hi,

I'm not habving much look with the ajax control toolkit.

1 - I was getting intellisense errors and

Changing

<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
namespace="System.Web.UI"
tagPrefix="asp" />

to...

<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
namespace="System.Web.UI"
tagPrefix="ajax" />


...seemed to fix those problems.

However, I still does not work. I'm using a test page with the autoCompleteExtender. When I compile and run, I get no compilation errors but two javascript errors in the browser (firefox 2.0):

"Sys is not defined"

Not impressed with lack of propper error reporting.

Anyone know what might be going on?


Br,

Scott

This is an error related with the js file which comes along with the Source code of AjaxToolKit, but i suggest u to use AjaxToolKit.dll instead.


Hi Scott,

First of all , we should know if we use an AJAX Control Toolkit control on the page , we shall first install ASP.NET AJAX Extensions then add reference to the AjaxControlToolkit.dll( or install the AJAX template). Please see these two video tutorials (Extensions, AJAX Control Toolkit.)

sosh:

Changing

<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
namespace="System.Web.UI"
tagPrefix="asp" />

to...

<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
namespace="System.Web.UI"
tagPrefix="ajax" />

Actually,

<controls>
<add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" tagPrefix="ajaxToolkit"/> <!-- register the AjaxControlToolkit -->
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, 1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <!-- register the ASP.NET AJAX Extensions -->

sosh:

"Sys is not defined"

It is usually related to the Asp.net AJAX Extensions. We suggest that you should download a sample fromhttp://www.asp.net/learn/ajax-videos/ and have a glance of its source code and web.config settings.

I hope this help.

Best regards,

Jonathan

Saturday, March 24, 2012

Ajax timeout when debugging ASP.Net code

How can I prevent Ajax timeout errors while debugging my ASP.net code using Visual Studio? My page uses the Timer control, so it should be the cause of the problem.Set the page's ScriptManager property:

AsyncPostBackTimeout

="0"

Wednesday, March 21, 2012

AJAX still having core problems?

I started using ajax with vs 2005 and the problem is
Pages creating onclick="return TABLE1_onclick()" causing javascript errors which came out from NOWHERE!!!!

For some reason the HTML that is being created by my ASP.Net pages
(2.0) have a table like this:Can u beleive it?

<table border="0" cellpadding="0" cellspacing="0" style="z-index: 103;
left: 0px; width: 100%; position: absolute; top: 0px;" id="TABLE1"
onclick="return TABLE1_onclick()"
This ends up causing a javascript error "Object excpected" when you
click on the page because there is no TABLE1_onclick() function. Why
is it doing this and what can I do to get it to stop? I'm not doing
anything fancy, just creating simple pages using a master page.

Thanks,

PS:asp.net team needs to work harder if they wanna hold some ground against other ajax vendors.

Hi,

Can you show me the relative code to help me reproducing the issue?
Looking forward to your reply.

<%

@.PageAutoEventWireup="true"CodeFile="musteri_alici.aspx.cs"Inherits="FORMS_MUSTERI_musteri_anasayfa"Language="C#"MasterPageFile="~/MASTERPAGE/OEO.master"Title="Mü?teri Anasayfa" %>

<

asp:ContentID="Content1"ContentPlaceHolderID="cphAna"runat="Server"><tableborder="0"cellpadding="0"cellspacing="0"style="width: 100%"><tr><tdclass="Beyaz10Bold"colspan="7"style="padding-left: 5px; height: 40px; background-color: #e5c130;

text-align: left">tt

Mü?terilerim

<br/>

Al?c?lar

</td></tr><tr><tdcolspan="7"><span><asp:ImageID="imgBosluk"runat="server"Height="20px"ImageUrl="~/IMAGES/bosluk.gif"Width="1px"/></span></td></tr></table><tablestyle="width: 100%"border="0"cellpadding="0"cellspacing="0"><tr><tdstyle="padding-bottom: 1px; padding-top: 1px; background-color: #f7ecc0; "><tableborder="0"cellpadding="0"cellspacing="0"style="width: 100%"><tr><tdstyle="text-align: center;"><asp:ButtonID="btnYeniMusteriUst"runat="server"Text="Yeni Mü?teri"OnPreRender="btnYeniMusteri_PreRender"CssClass="button"/></td></tr></table></td></tr></table>

<tableid="tblMusteri"runat="server"border="0"cellpadding="0"cellspacing="0"style="width: 100%"><tr><tdid="tdAlt"runat="server"colspan="6"style="height: 18px"></td></tr></table><asp:GridViewID="grdAlici"runat="server"AutoGenerateColumns="False"BorderWidth="1px"CellPadding="2"GridLines="None"Width="100%"OnRowDataBound="grdAlici_RowDataBound"DataKeyNames="_ID,MEMBERID"AllowPaging="True"CssClass="Kirmizi9Bold"PageSize="25"OnPageIndexChanging="grdAlici_PageIndexChanging"EmptyDataText="Kay?t Bulunamad?"><Columns><asp:TemplateFieldHeaderText="??lem"><ItemTemplate><tableborder="0"cellpadding="0"cellspacing="0"id="TABLE1"onclick="return TABLE1_onclick()"><tr><tdstyle="width: 105px; "><asp:HyperLinkID="hplAliciGit"runat="server"CssClass="Siyah10">Git</asp:HyperLink>

|

<asp:HyperLinkID="hplAliciDuzenle"runat="server"CssClass="Siyah10">Düzenle</asp:HyperLink>

|

<asp:LinkButtonID="lnkAliciSil"runat="server"OnClick="lnkSilAlici_Click"CssClass="Siyah10">Sil</asp:LinkButton></td></tr></table></ItemTemplate></asp:TemplateField><asp:BoundFieldHeaderText="?sim"DataField="_NAME"><HeaderStyleWidth="15%"/></asp:BoundField><asp:TemplateFieldHeaderText="Y?ld?z"></asp:TemplateField><asp:BoundFieldHeaderText="Son ?leti?im Tarihi"/><asp:BoundFieldHeaderText="Telefon"DataField="MOBILETEL"><HeaderStyleWidth="15%"/></asp:BoundField><asp:TemplateFieldHeaderText="Aktivite"><ItemStyleHorizontalAlign="Left"/><ItemTemplate><asp:LabelID="lblAlici"runat="server"CssClass="Siyah10"></asp:Label></ItemTemplate></asp:TemplateField>

</Columns><PagerStyleHorizontalAlign="Center"/><HeaderStyleBackColor="#E5E5E5"CssClass="Siyah10Bold"/><AlternatingRowStyleBackColor="White"/><RowStyleCssClass="Siyah10"/><EmptyDataRowStyleCssClass="Kirmizi9Bold"Height="30px"HorizontalAlign="Left"/></asp:GridView><br/><tableborder="0"cellpadding="1"cellspacing="1"class="Siyah10"><tr><tdstyle="width: 5px;"align="left"class="Siyah8"><span><asp:HyperLinkID="hplA"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=A"CssClass="Siyah8">A</asp:HyperLink></span></td><tdalign="left">

|

</td><tdstyle="width: 5px;"align="left"class="Siyah8"><asp:HyperLinkID="hplB"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=B"CssClass="Siyah8">B</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=1&go=+Go%21+"><spanstyle=""/></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplC"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=C"CssClass="Siyah8">C</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=2&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hpl?"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=?"CssClass="Siyah8">?</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=2&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplD"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=D"CssClass="Siyah8">D</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=3&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplE"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=E"CssClass="Siyah8">E</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=4&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplF"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=F"CssClass="Siyah8">F</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=5&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplG"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=G"CssClass="Siyah8">G</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=6&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplH"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=H"CssClass="Siyah8">H</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=7&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplI"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=I"CssClass="Siyah8">I</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=8&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hpl?"runat="server"Width="1px"CssClass="Siyah8">?</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=8&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplJ"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=J"CssClass="Siyah8">J</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=9&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplK"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=K"CssClass="Siyah8">K</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=10&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplL"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=L"CssClass="Siyah8">L</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=11&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplM"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=M"CssClass="Siyah8">M</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=12&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplN"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=N"CssClass="Siyah8">N</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=13&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplO"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=O"CssClass="Siyah8">O</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=14&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hpl?"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=?"CssClass="Siyah8">?</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=14&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplP"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=P"CssClass="Siyah8">P</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=15&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplQ"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=Q"CssClass="Siyah8">Q</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=16&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplR"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=R"CssClass="Siyah8">R</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=17&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplS"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=S"CssClass="Siyah8">S</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=18&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hpl?"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=?"CssClass="Siyah8">?</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=18&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplT"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=T"CssClass="Siyah8">T</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=19&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplU"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=U"CssClass="Siyah8">U</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=20&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplü"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=ü"CssClass="Siyah8">ü</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=20&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplV"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=V"CssClass="Siyah8">V</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=21&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplW"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=W"CssClass="Siyah8">W</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=22&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplX"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=X"CssClass="Siyah8">X</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=23&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplY"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=Y"CssClass="Siyah8">Y</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=24&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="width: 5px"class="Siyah8"><asp:HyperLinkID="hplZ"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=Z"CssClass="Siyah8">Z</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=25&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left">

|

</td><tdalign="left"style="height: 18px"><asp:HyperLinkID="hplOther"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx?harf=Diger"CssClass="Siyah8">Di?er</asp:HyperLink><ahref="/006?fcf=00B30000002Mqk3&lsc=26&go=+Go%21+"><spanstyle=""></span></a></td><tdalign="left"style="height: 18px">

|

</td><tdalign="left"style="width: 17px; height: 18px"class="Siyah8"><spanclass="bodyBold"><asp:HyperLinkID="hplAll"runat="server"Width="1px"NavigateUrl="~/FORMS/MUSTERI/musteri_alici.aspx"CssClass="Siyah8">Tümü</asp:HyperLink></span></td></tr></table>

<tableborder="0"cellpadding="0"cellspacing="0"style="width: 100%"><tr><tdclass="Siyah9"style="padding-left: 5px; padding-top: 15px; text-align: left; height: 31px;">

* Di?er menüsünde kurum, i? ortaklar? gibi extra mü?teri tipleri bulunmaktad?r.

</td></tr></table><br/><tablestyle="width: 100%"border="0"cellpadding="0"cellspacing="0">

<tr><tdstyle="padding-bottom: 1px; padding-top: 1px; background-color: #f7ecc0"><tableborder="0"cellpadding="0"cellspacing="0"style="width: 100%">

<tr><tdstyle="text-align: center;"><asp:ButtonID="btnYeniMusteriAlt"runat="server"CssClass="button"Text="Yeni Mü?teri"OnPreRender="btnYeniMusteri_PreRender"/></td></tr></table></td></tr></table>

</

asp:Content>

<%

--Halil--%>
It seems theonclick="return TABLE1_onclick()" is added by your code.
I think it's your responsibility to add the corresdponding javascript function.

Ajax SlideShow Help

Can Someon help me to convert C# to Vb this web service code from SlideShow example? I already tried conversion tools and it gives me some errors. Thank You All.

<

scriptrunat="Server"type="text/C#">

[System.Web.Services.

WebMethod]

[System.Web.Script.Services.

ScriptMethod]publicstatic AjaxControlToolkit.Slide[] GetSlides()

{

returnnew AjaxControlToolkit.Slide[] {new AjaxControlToolkit.Slide("images/Blue hills.jpg","Blue Hills","Go Blue"),new AjaxControlToolkit.Slide("images/Sunset.jpg","Sunset","Setting sun"),new AjaxControlToolkit.Slide("images/Winter.jpg","Winter","Wintery..."),new AjaxControlToolkit.Slide("images/Water lilies.jpg","Water lillies","Lillies in the water"),new AjaxControlToolkit.Slide("images/VerticalPicture.jpg","Sedona","Portrait style picture")};

}

</script>

<System.Web.Services.WebMethod()> _

<System.Web.Script.Services.ScriptMethod()> _

PublicSharedFunction GetPictures()As AjaxControlToolkit.Slide()ReturnNew AjaxControlToolkit.Slide() { _New AjaxControlToolkit.Slide("images/Blue hills.jpg","Blue Hills","Go Blue"), _New AjaxControlToolkit.Slide("images/Sunset.jpg","Sunset","Setting sun"), _New AjaxControlToolkit.Slide("images/Winter.jpg","Winter","Wintery..."), _New AjaxControlToolkit.Slide("images/Water lilies.jpg","Water lillies","Lillies in the water"), _New AjaxControlToolkit.Slide("images/VerticalPicture.jpg","Sedona","Portrait style picture")}

End

Function

Ken Tucker:

<System.Web.Services.WebMethod()> _

<System.Web.Script.Services.ScriptMethod()> _

PublicSharedFunction GetPictures()As AjaxControlToolkit.Slide()

ReturnNew AjaxControlToolkit.Slide() { _

New AjaxControlToolkit.Slide("images/Blue hills.jpg","Blue Hills","Go Blue"), _

New AjaxControlToolkit.Slide("images/Sunset.jpg","Sunset","Setting sun"), _

New AjaxControlToolkit.Slide("images/Winter.jpg","Winter","Wintery..."), _

New AjaxControlToolkit.Slide("images/Water lilies.jpg","Water lillies","Lillies in the water"), _

New AjaxControlToolkit.Slide("images/VerticalPicture.jpg","Sedona","Portrait style picture")}

EndFunction

Thank You Ken.


Ken Tucker:

<System.Web.Services.WebMethod()> _

<System.Web.Script.Services.ScriptMethod()> _

PublicSharedFunction GetPictures()As AjaxControlToolkit.Slide()ReturnNew AjaxControlToolkit.Slide() { _New AjaxControlToolkit.Slide("images/Blue hills.jpg","Blue Hills","Go Blue"), _New AjaxControlToolkit.Slide("images/Sunset.jpg","Sunset","Setting sun"), _New AjaxControlToolkit.Slide("images/Winter.jpg","Winter","Wintery..."), _New AjaxControlToolkit.Slide("images/Water lilies.jpg","Water lillies","Lillies in the water"), _New AjaxControlToolkit.Slide("images/VerticalPicture.jpg","Sedona","Portrait style picture")}

End

Function

How can I populate this array dynamically? For example, Read some folder with images and create an array?

ForEach sIn Directory.GetFiles(Server.MapPath("my_vacation"),"*.jpg")

Response.write ( Path.GetFileName(s) )

Next


I saw that you answered the dynamic file issue with

ForEach sIn Directory.GetFiles(Server.MapPath("my_vacation"),"*.jpg")

Response.write ( Path.GetFileName(s) )

Next

But how do I get it to dynamically use a value from an SQL table field.

My images have names such as R12345.jpg, R12345_2.jpg, R12345_3.jpg etc...

The listing_id field value is R12345 which would need to replace the "my_vacation" above.

How can I get this to work?

Thanks for your help!

Mike


Imports System.IO
Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
MyData.ImagePath = Server.MapPath("~/Images")
Dim strUrl As String = Request.Url.ToString

MyData.Url = strUrl.Substring(0, strUrl.LastIndexOf("/")) & "/Images/"
End Sub


<System.Web.Services.WebMethod()> _
<System.Web.Script.Services.ScriptMethod()> _
Public Shared Function GetPictures() As AjaxControlToolkit.Slide()
Dim di As New DirectoryInfo(MyData.ImagePath)
Dim s(di.GetFiles.Length - 1) As AjaxControlToolkit.Slide
Dim x As Integer = 0
For Each fi As FileInfo In di.GetFiles()
s(x) = New AjaxControlToolkit.Slide(MyData.Url & fi.Name, "", Path.GetFileNameWithoutExtension(fi.Name))
x += 1
Next
Return s
End Function
End Class

Public Class MyData
Private Shared _Path As String
Private Shared _Url As String

Public Shared Property ImagePath() As String
Get
Return _Path
End Get
Set(ByVal value As String)
_Path = value
End Set
End Property

Public Shared Property Url() As String
Get
Return _Url
End Get
Set(ByVal value As String)
_Url = value
End Set
End Property
End Class


AWESOME!

How can I get it to retrieve images at a url other that mine, such as:

http://www.xyz.com/images

Thanks,

Mike


If you have ftp access to the images you can try something like this.

<System.Web.Services.WebMethod()> _
<System.Web.Script.Services.ScriptMethod()> _
Public Shared Function GetFtpPictures() As AjaxControlToolkit.Slide()
Dim ftp As FtpWebRequest = WebRequest.Create("ftp://ftp.xyz.com/images")
ftp.Credentials = New NetworkCredential("YourUserName", "YourPassword")
ftp.Method = WebRequestMethods.Ftp.ListDirectory
Dim wr As WebResponse =ftp.GetResponse
Dim sr As New StreamReader(wr.GetResponseStream)
Dim lst As New List(Of String)
Do While sr.Peek > 0
Dim strOut As String
strOut = sr.ReadLine
lst.Add(strOut)
Loop
Dim s(lst.Count - 1) As AjaxControlToolkit.Slide
Dim x As Integer = 0
For Each str As String In lst
Dim i As Integer = str.IndexOf("."c)
s(x) = New AjaxControlToolkit.Slide("http://www.xyz.com/images/" & str, "", str.Substring(0, i))
x += 1
Next
Return s
End Function

Article on how to use photos stored in Flickr in a slide show

http://www.onteorasoftware.com/blog.aspx?BlogID=75


pashaKasim this site may help you. You may already know about it, but there might be someone out there who hasnt run across this tool yet.

http://www.developerfusion.co.uk/utilities/convertcsharptovb.aspx

J


Really usefull piece of code.I would like to use a slider control to move across page.For that to be implemented i need to move to the Nth image.Is there a method / way to move to the Nth image.ThanksRain Man Alex