AjaxEvent and Dynamic content

  1. #1

    AjaxEvent and Dynamic content



    Hi,

    I can't understand why so simple thing does not work.

    I have a toolbar with a combobox on it, and picture on page. by combobox select - I want to display another picture.
    The problem is - code executed, event handler works, property value redefined but picture still a same!*

    Here is a simple code what I have

    
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Test_Viewer.aspx.vb" Inherits="TestPages_Test_Viewer" %>
    
    <%@ Register assembly="Coolite.Ext.Web" namespace="Coolite.Ext.Web" tagprefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    *   <title>Untitled Page</title>
    *   <link href="Css/AnotoViewer.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    *   <form id="form1" runat="server">
    *   <ext:ScriptManager ID="ScriptManager1" runat="server" />
    *   <ext:Toolbar ID="Toolbar1" runat="server" IDMode="Legacy" Height="28px">
    *            <Items>
    *           *
    *                      <ext:ComboBox ID="cboPages" runat="server" ReadOnly="true" AutoPostBack="true">
    *                           <Items>
    *                           <ext:ListItem Text="Seite 1" Value="1" />
    *                           <ext:ListItem Text="Seite 2" Value="2" />
    *                           </Items>
    *                       <AjaxEvents>
    *                           <Select OnEvent="mmks_cboPagesChange" ViewStateMode="Include"></Select>
    *                       </AjaxEvents>
    *                       </ext:ComboBox>
    *                    *
    *
    *           *
    *            </Items>
    *        </ext:Toolbar>
    *   <asp:Image ID="Image1" runat="server" ImageUrl="~/Resources/pensolutionlogo1.jpg" />
    *   </form>
    </body>
    </html>

    And Event handler

    
    
    Partial Class TestPages_Test_Viewer
    *   Inherits System.Web.UI.Page
    
    *   Protected Sub mmks_cboPagesChange()
    *       If Me.Image1.ImageUrl = "~/Resources/pensolutionlogo1.jpg" Then
    *           Me.Image1.ImageUrl = "~/Resources/pensolutionlogo2.jpg"
    *       Else
    *           Me.Image1.ImageUrl = "~/Resources/pensolutionlogo1.jpg"
    *       End If
    
    *   End Sub
    End Class

    Thanks!
  2. #2

    RE: AjaxEvent and Dynamic content

    Hi,

    You can't change none Coolite controls during AjaxEvent. AjaxEvent send back to the client java script to change state. So, if control (like ASP.NET controls) doesn't support AjaxEvent then all changes will be lost after request.


    You can change Coolite controls (please note that not all properties can be changed during AjaxEvent). In 0.8 version there is Coolite.Ext.Web.Image control which support changing Url during AjaxEvent


  3. #3

    RE: AjaxEvent and Dynamic content

    The Coolite Image control sounds great. We really need that.
  4. #4

    RE: AjaxEvent and Dynamic content

    Hi dbassett74,

    Here's an example demonstrating use of the new <ext:Image> control in v0.8.

    Example

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Button1_Click(object sender, AjaxEventArgs e)
        {
            this.Image1.ImageUrl = "/images/Image2.jpg";
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ScriptManager ID="ScriptManager1" runat="server" />
            
            <ext:Button ID="Button1" runat="server" Text="Update">
                <AjaxEvents>
                    <Click OnEvent="Button1_Click" />
                </AjaxEvents>
            </ext:Button>
            
            <ext:Image ID="Image1" runat="server" ImageUrl="/images/Image1.jpg" />
        </form>
    </body>
    </html>
    The <ext:Image> control will be available with the public release of v0.8.

    Hope this helps.

    Geoffrey McGill
    Founder

Similar Threads

  1. Replies: 0
    Last Post: Jan 06, 2012, 8:52 AM
  2. [0.8] Update content with AjaxEvent.
    By mojo in forum 1.x Help
    Replies: 0
    Last Post: Oct 14, 2010, 3:01 PM
  3. dynamic ajaxevent on menuitem
    By tonymayoral in forum 1.x Help
    Replies: 4
    Last Post: Jul 24, 2009, 2:55 AM
  4. [CLOSED] TabPanel load content in AjaxEvent
    By methode in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 01, 2009, 1:26 PM
  5. ViewPort - new dynamic tab content
    By tdmf40 in forum 1.x Help
    Replies: 1
    Last Post: Apr 28, 2008, 4:32 PM

Posting Permissions