Category Archives: AdRotator

AdRotator

[RESOLVED]Ajax AdRotator and Page load behavior

Hello, When page refreshes due to time trigger, page focuses on that updated page portion, which is annoying. Please see this behavior here: (scroll page and you will be redirected to the same "Also Available On" section, I don’t want that): http://www.usmaniacomplex.com/Downloads/UCL_1_0.aspx and http://www.usmaniacomplex.com/Downloads/UKM_1_0.aspx . 

Code:

<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
</asp:ScriptManager>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
   <ContentTemplate>

        // Comments panel

   </ContentTemplate>

</asp:UpdatePanel>

<asp:UpdatePanel ID="UpdatePanel2" runat="server">
   <ContentTemplate>
        <asp:AdRotator ID="AdRotator1" runat="server" Target="_self" DataSourceID="XmlDataSource1" />
        <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/some.xml"></asp:XmlDataSource>
        <asp:Timer ID="Timer1" runat="server" Interval="2000"></asp:Timer>
   </ContentTemplate>
</asp:UpdatePanel>

See if this helps you: http://forums.asp.net/t/1156877.aspx

http://forums.asp.net/t/1513472.aspx

Specifically the post with this snippet:

<script type="text/javascript"> var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_beginRequest(beginRequest);
function beginRequest() {     prm._scrollPosition = null; } < /script>

http://aspnet.4guysfromrolla.com/articles/111704-1.aspx

<pages smartNavigation="true"MaintainScrollPositionOnPostback="true"/>

http://basgun.wordpress.com/2008/06/09/maintain-scroll-position-updatepanel-postback/

[RESOLVED]version

I have XP pro with VS2005 v 8.0.50727 with .net2.0sp2 , .net3.0sp2 and .net3.5sp1

How can I find out what version of ASP.NET I am using 1.0 , 2.0 , 3.0 , 3.5

 

In the VStoolbox and intellisense there are only 3 image related controls.

ButtonImage , Image and ImageMap

I have been reading  about DynamicImage and ImageGenerator

How can I get these controls/classes working?

What is the best way to approach dynamic images in asp.net?

PeterRod

 From what I remember DynamicImage and ImageGenerator were cut out of ASP.NET 2.0 so they were only available for v1.x

Saying that there is something about a ASP.NET Generated Image component on CodePlex,
not sure what it does mind you.

whighfield

 From what I remember DynamicImage and ImageGenerator were cut out of ASP.NET 2.0 so they were only available for v1.x

Saying that there is something about a ASP.NET Generated Image component on CodePlex,
not sure what it does mind you.

 

William, thanks for the assistance. I checked out the link.

I am still troubled by how do I find out for certain what version number of ASP.NET I am using?

In vs2005 its easy to know but I dont know how to do it in ASP.NET?

Also, whats a good place to start as far as building dynamic images in asp.net?

Thanks

 

For the verson number

http://digitalcolony.com/2007/06/detect-aspnet-version-running-on-server.aspx 

As for building dynamic images in asp.net I am not sure what you mean or want, you can always try searching Google.

Thanks on version number.

 

Image Questio:

As you can tell I am very new to asp.net  I have done some programming in Windows Forms VB language and MASM32. Actually I have written 3-4 quite large apps.

I recently built a website using html and php scripts. That site is up. 

Then I figured why not try building a site in asp.net as I already have vs2005.

One of the features I would like on the asp site is to be able to display  6 .jpg images each one for about 20 secs without any client interaction and to have the display continue repeating the images. Do I use AdRotator or some code in the pageLoad event
handler or what about UpdatePanel in the Ajax Extensions?

I just wanted to get some advice on the best approach.

Thanks

  

 

There are probably Flash or Silverlight based slide shows for images as well there are a few JavaScript based slide shows out there.  I would not bother building something like that myself.

[RESOLVED]Tab acts like postback and changes Tab (to index = 1!) without firing TabChanged event

Hello,

I’m using Ajax Toolkit – Tabs, PopupControlExtender and the old UpdatePanel for a Gridview Refresh.

The sequence is as follows:

- First tab has a gridview1

- Second tab has some textboxes, one of wich has attached a PopupControlExtender; this extender brings up a Panel that holds a smaller gridview2 from wich I can select a record to populate the textboxes. I managed to do it by putting the gridview2 and the
"search button" in an Update Panel.

Problem: now when i get back to tab1, anything i do on the gridview1 (sort, page index chage, select row) it takes me back to tab2. No tabchange event is being fired! This is driving me crazy! 

Dh you have any sugestions ? Any advice is appreciated.

Thanks.

Update:

Forget about the update panel and gridview2. It’s even simpler: even if I put just a button on tab2 and click it (without submit behaviour), it does it’s job, but when i go  to tab2 and try to do something with the gridview1, it throws me back on tab2.

Note: if i put a button on tab3, it throws me to tab3.

Ideas, anyone ?

Here’s a simplified version of my code that reflects the problem i have:

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<ajaxtoolkit:tabcontainer ID="TabContainer1" runat="server" AutoPostBack="false" OnClientActiveTabChanged="tabChanged" ActiveTabIndex="1">
<ajaxToolkit:TabPanel ID="TabPanel2" runat="server">
<HeaderTemplate>Tab2</HeaderTemplate>
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="true" AutoGenerateSelectButton="True">
</asp:GridView>
</ContentTemplate>
</ajaxToolkit:TabPanel>
<ajaxToolkit:TabPanel ID="TabPanel1" runat="server">
<HeaderTemplate>Tab1</HeaderTemplate>
<ContentTemplate>
<div id ="myDiv"><%=DateTime.Now.ToString() %></div>

<asp:Button ID="Button1" runat="server" Text="Button" />

</ContentTemplate>
</ajaxToolkit:TabPanel>
</ajaxtoolkit:tabcontainer>
<asp:AdRotator ID="AdRotator1" runat="server" />
<script type="text/javascript" language="javascript">
function tabChanged() {
}
</script>

Ok, I solved it.

I’ve placed a hidden button (hidden by css) in the first tab and click on it (java script) every time the user enters tab1. This way ensures that tab1 remains active.

If anyone can come up with a better solution, I can hardly wait to see it.

Cheers. 

[RESOLVED]How to use adrotator to slide images in right to left direction?

I was trying to slide images in right to left direction and I successfully did the same by using jquery. These images are static. But now I want to say use a single control to slide top 4 images from my database. I heard about and also tried adrotaor control.
But how can I use this control say to fetch top 4 images from my database along with their particular navigate url? Please guide me for this query. I am also curious to know is there any other control in asp.net which will help me to do the same. I am waiting
for your all expert and helpful suggestions.
Thank You in advance.

If you want to use the AdRotator control, here are the steps to follow:

Create a database table with the following fields – all fields except ID are optional:

Column name

Data type

Description

ID

int

The primary key. This column can have any name.

ImageUrl

nvarchar(length)

The relative or absolute URL of the image to display for the ad.

NavigateUrl

nvarchar(length)

The target URL for the ad. If you do not provide a value, the ad is not a hyperlink.

AlternateText

nvarchar(length)

The text displayed if the image cannot be found. In some browsers, the text is displayed as a ToolTip. Alternate text is also used for accessibility so that users who cannot see the graphic can hear its description read out loud.

Keyword

nvarchar(length)

A category for the ad on which the page can filter.

Impressions

int(4)

A number that indicates the likelihood of how often the ad is displayed. The larger the number, the more often the ad will be displayed. The total of all impressions values in the XML file may not exceed 2,048,000,000 – 1.

Width

int(4)

The width of the image in pixels.

Height

int(4)

The height of the image in pixels.

Then populate your database.

Retrieve the data from the database and set the DataTable as the AdRotator’s datasource, like this:

private DataTable GetAds()
{
	string sql = "select * from YourAdRotatorTableName"; 
	SqlDataAdapter da = new SqlDataAdapter(sql, ); 
	DataTable dt = new DataTable(); 
	da.Fill(dt); 
}

Then set this in Page_Load and in the AdRotater Time1_Tick methods:

AdRotator1.DataSource = GetAds(); 
AdRotator1.DataBind();

Sources: http://msdn.microsoft.com/en-us/library/cc295605.aspx

http://www.aspdotnetcodes.com/Asp.Net_AdRotator_Database.aspx 

WebControls in MVC??

Hi everyone!!

Is there a way to insert a WebControl in a ASP.NET MVC project??

 Thanks!!

 Sure you can!  You probably won’t get the results you expect though because most webcontrols rely on ViewState and such… Things like AdRotator controls work great though…

 

What are you trying to accomplish?  There’s a project called MVCContrib that’s aimed at bridging the gap a bit and providing some of the out-of-the-box exprience that webforms has over to mvc.

For example, I’ve tried to use ASP.NET Calendar, but it didn’t work, even if I change its ViewState to false….

[RESOLVED]How Can I add a slideshow into MS Visual Web Developer 2008 Express Edition

I tried using flash but could not get through. Can you tell me if I can import a power point slide into Web Developer????

I’m a novice to the application and would appreciate your help!!

Kasera,

there are 3 ways

1. use AJAX Slide Show control like
this

2. use JQuery slide show plugin like
this

3. use simple asp.net built in Ad-rorator control like
this
 and
this

thank you so much for your help…

[RESOLVED]problem with timer and watermark

hi,

i have used an timer and adrotor inside update panel control in my master page of asp.net web site. in another page i have some text boxes with watermark.

my problem is that the watermarks refresh when timer tick raises.

my code for pages.aspx:

<%@ Page Language="C#"  MasterPageFile="~/MasterPageMain.master"  AutoEventWireup="true" maintainscrollpositiononpostback="true"  CodeFile="Pages.aspx.cs" Inherits="Pages" %>


<asp:Content ID="Content1" runat="Server" ContentPlaceHolderID="ContentPlaceHolderMain">
 <asp:ScriptManagerProxy id="ScriptManagerProxy1" runat="server">
    </asp:ScriptManagerProxy>
     
<div class="grid" dir="rtl">
            <div class="rounded">
                <div class="top-outer">
                    <div class="top-inner">
                        <div class="top">
                            <h2 style="color:Yellow">
                                your comment</h2>
                        </div>
                    </div>
                </div>
                <div class="mid-outer">
                    <div class="mid-inner">
                        <div class="mid">
                           <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                <ContentTemplate>
                            <table style="width: 100%">
                                <tr>
                                    <td>
                                        your Name:</td>
                                    <td style="width: 80%">
                                        <asp:TextBox ID="TextBox_Name" runat="server" CssClass="TextBox" Width="50%"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox_Name"
                                            ErrorMessage="please Inter Your Name" ValidationGroup="4546">*</asp:RequiredFieldValidator>
                                        <Ajax:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server" TargetControlID="TextBox_Name"
                                            WatermarkCssClass="WaterMark" WatermarkText="Inter Your Name">
                                        </Ajax:TextBoxWatermarkExtender>
                                    </td>
                                </tr>
                                <tr style="color: #000000">
                                    <td>
                                        EMail:</td>
                                    <td>
                                        <asp:TextBox ID="TextBox_Email" runat="server" CssClass="TextBox" Width="50%"></asp:TextBox>
                                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox_Email"
                                            ErrorMessage="Please Enter Email Address Correctly" ValidationExpression="w+([-+.']w+)*@w+([-.]w+)*.w+([-.]w+)*"
                                            ValidationGroup="4546">*</asp:RegularExpressionValidator>
                                        <Ajax:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender2" runat="server" TargetControlID="TextBox_Email"
                                            WatermarkCssClass="WaterMark" WatermarkText="Enter Your Email Address">
                                        </Ajax:TextBoxWatermarkExtender>
                                    </td>
                                </tr>
                                <tr style="color: #000000">
                                    <td style="vertical-align: top">
                                        Your Comment:<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="TextBox_Comment"
                                            ErrorMessage="Please Enter Your Comment" ValidationGroup="4546">*</asp:RequiredFieldValidator></td>
                                    <td style="color: #000000">
                                        <asp:TextBox ID="TextBox_Comment" runat="server" CssClass="TextBox" Height="74px"
                                            TextMode="MultiLine" Width="98%"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <asp:ValidationSummary ID="ValidationSummary1" runat="server" Style="float: right"
                                            ValidationGroup="4546" />
                                        <Ajax:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender3" runat="server" TargetControlID="TextBox_Comment"
                                            WatermarkCssClass="WaterMark" WatermarkText="Enter Your Comment">
                                        </Ajax:TextBoxWatermarkExtender>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2" style="text-align: center">
                                        <asp:Button ID="Button_Save" runat="server" CssClass="Button" OnClick="Button_Save_Click"
                                            Text="Save" ValidationGroup="4546" /><br />
                                        <Ajax:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" ConfirmText="Are You Sure for Saving"
                                            TargetControlID="Button_Save">
                                        </Ajax:ConfirmButtonExtender>
                                        <asp:SqlDataSource ID="SqlDataSource_EnterMenuComments" runat="server" ConnectionString="<%$ ConnectionStrings:LocalSqlServer1 %>"
                                            InsertCommand="Menu_InsertComments" InsertCommandType="StoredProcedure" OnInserted="SqlDataSource_EnterMenuComments_Inserted"
                                            ProviderName="<%$ ConnectionStrings:LocalSqlServer.ProviderName %>">
                                            <InsertParameters>
                                                <asp:ControlParameter ControlID="TextBox_Name" Name="AddedBy" PropertyName="Text"
                                                    Type="String" />
                                                <asp:ControlParameter ControlID="TextBox_Email" Name="AddedByEmail" PropertyName="Text"
                                                    Type="String" />
                                                <asp:Parameter Name="AddedByIP" Type="String" />
                                                <asp:Parameter Name="MenuID" Type="Int32" />
                                                
                                                <asp:ControlParameter ControlID="TextBox_Comment" Name="Body" PropertyName="Text"
                                                    Type="String" />
                                            </InsertParameters>
                                        </asp:SqlDataSource>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2" style="text-align: center">
                                        <asp:Label ID="Label_Message" runat="server" ForeColor="Blue"></asp:Label></td>
                                </tr>
                            </table>
                                </ContentTemplate>
                                <Triggers>
                                
                                <asp:PostBackTrigger ControlID="Button_Save"></asp:PostBackTrigger>
                                </Triggers>
                            </asp:UpdatePanel>
                            
                        </div>
                    </div>
                </div>
                <div class="bottom-outer">
                    <div class="bottom-inner">
                        <div class="bottom">
                        </div>
                    </div>
                </div>
            </div>
        </div>
   
</asp:Content>

Master Page Code:

 
<table><tr><td style="width:217px; height:200px" >
                                           <asp:Panel runat="server">
                                          <asp:UpdatePanel id="UpdatePanel1" runat="server">
                 
                                          <ContentTemplate>
                                            <asp:Timer ID="Timer1" runat="server" Interval="2000" ontick="Timer1_Tick" >
                                              </asp:Timer>
                                               <asp:AdRotator ID="AdRotator1" runat="server" Height="200px" Width="217px" BorderColor="Blue" />
                                          </ContentTemplate>
       
                  </asp:UpdatePanel>
                    </asp:Panel>
                      </td>

</tr>
</table>
<asp:ScriptManager ID="ScriptManager1" runat="server">
  </asp:ScriptManager>
        <asp:contentplaceholder id="ContentPlaceHolderMain" runat="server" >
        </asp:contentplaceholder>

and in code behind of master page in page_load and Timer Tick i use this code:

        AdRotator1.DataSource = FetchAdsFromDB();
        AdRotator1.DataBind();

please help me for solving this problem.

thanks regard

hi saeid6366 ,

From what I understand you want to handle my problem is that the watermarks refresh when timer tick raises. 

Reason:

This behavior is because Jquery watermark is client-side. 

Solution:

I would suggest you to try adding this to the page head:

<script type="text/javascript">
    function pageLoad() {

        $find('behavior')._onSubmit = function() {

        };
    }

</script>

And then add  BehaviorID ="behavior" in the TextboxWaterMark control. 

Please read the reference below for more information:

jquery WaterMark Textbox blink on postback

TextBoxWatermarkExtender blinks on postback 

I hope it helps you.

thanks very much,

I add this code above all codes in content control in pages.aspx, but face to ather problems, timer clock not raise and adrotator image not change and only first watermark is shown ( i have 3 watermarks).

why this problem occured?

hi saeid6366,

Firstly, I suggest you to check your html resource  run in debug mode or  press F12 (Debug Tool) in IE brower.

Secondly, you can try the other brower(Fix,Chrome e.g.) to run it.

Here is a demo:

http://www.webcodeexpert.com/2013/07/how-to-use-ajax-textboxwatermarkextende.html#.Ui1jgCawqM8

I hope it helps you.

As @happy… suggested

just add this code :

<script type="text/javascript">
        function pageLoad() {
            $find('bhSearch')._onSubmit = function() {

            };
        }
</script>

Where bhSearch is behaviourID of ajax watermarktextextender. And then check it out…

It solved my problem…