[CLOSED] Post back Issue with ASP image button in EXT Panel

  1. #1

    [CLOSED] Post back Issue with ASP image button in EXT Panel

    Hi Team,
    We are having a problem with ASP controls in our Project.
    Actually we are using one ASP image button in my code so that on click of that button the EXT Store has to be reloaded and binded, but the problem is the data is not binding to the store.
    The Reason we are using the ASP image button is for it having the X and Y coordinates.
    Could you please Check the code.

    Please Let us know your thoughts.....

    Thanks & Regards
    Mohan
    Last edited by Daniil; Sep 02, 2013 at 12:26 PM. Reason: [CLOSED]
  2. #2
    Hi Mohan,

    Please read #3 here:
    http://forums.ext.net/showthread.php?10205
  3. #3
    ASPX Page

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PostbackProblem.aspx.cs" Inherits="Cresent.WorkSafeExt.GraphicalPlanner.PostbackProblem" %>
    
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ResourceManager ID="RMGPA" runat="server" />
            <asp:ScriptManager ID="SMUpate" runat="server" />
            <ext:Store ID="StrALEMaps" runat="server"><Model><ext:Model ID="mdALEMaps" runat="server"><Fields><ext:ModelField Name="MapType" Type="Int" /><ext:ModelField Name="MapID" Type="Int" /><ext:ModelField Name="Description" Type="String" /><ext:ModelField Name="X" Type="Int" /><ext:ModelField Name="Y" Type="Int" /><ext:ModelField Name="isActive" Type="Boolean" /></Fields></ext:Model></Model></ext:Store><ext:Panel ID="pnlGPACenters" runat="server" Region="Center" Border="true" Title="Graphical Planner" ButtonAlign="Left">
                <Items>
                    <ext:Panel ID="MainPanel" runat="server" Collapsible="true" Height="400" BodyPadding="30"><Content>
                            <asp:UpdatePanel ID="upImageMainMap" runat="server"><ContentTemplate><asp:Panel ID="pnl1" runat="server">
                                        <asp:ImageButton ID="ImageMainMap" OnClick="ImageMainMap_Click" runat="server" Height="50" ImageUrl="~/Images/heroAccent.png" AlternateText="Image " /></asp:Panel></ContentTemplate></asp:UpdatePanel></Content></ext:Panel>
                    <ext:Panel ID="PanelMapAreasLocationsEquitpments" runat="server" Layout="FitLayout" Height="400" ButtonAlign="Left" Collapsible="true">
                        <Items>
                            <ext:GridPanel ID="gpALE" runat="server" StoreID="StrALEMaps" Border="false" AutoScroll="true">
                                <ColumnModel ID="ctl512">
                                    <Columns>
                                        <ext:Column ID="ColMapID" runat="server" Text="MapID" DataIndex="MapID" Width="150" />
                                        <ext:Column ID="ColMapType" runat="server" Text="MapType" DataIndex="MapType" Width="200" />
                                        <ext:Column ID="ColDescription" runat="server" Text="Description" DataIndex="Description" Width="200" />
                                        <ext:Column ID="ColX" runat="server" Text="X" DataIndex="X" Width="150" />
                                        <ext:Column ID="ColY" runat="server" Text="Y" DataIndex="Y" Width="150" />
                                        <ext:CheckColumn ID="IsActive" runat="server" DataIndex="isActive" Text="Is Active" Width="150" />
                                    </Columns>
                                </ColumnModel>
                                <View><ext:GridView ID="gpAreaMappings" runat="server" LoadMask="true" /></View>
    <SelectionModel>
                                    <ext:RowSelectionModel ID="rsmGraphicalPlannerAdmin" runat="server" Mode="Single" />
                                </SelectionModel>
                            </ext:GridPanel>
                        </Items></ext:Panel></Items></ext:Panel>
        </form>
    </body>
    </html>
    Code Behind

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Ext.Net;
    
    
    
    
    namespace Cresent.WorkSafeExt.GraphicalPlanner
    {
        public partial class PostbackProblem : System.Web.UI.Page
        {
            protected List<MapPoints> listPoints
            {
                set
                {
                    Session["Points"] = value;
                }
                get
                {
                    if (Session["Points"] == null)
                        return new List<MapPoints>();
                    else
                        return ((List<MapPoints>)Session["Points"]);
                }
            }
    
    
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!X.IsAjaxRequest && !Page.IsPostBack)
                {
                    this.listPoints = new List<MapPoints>
    {
    new MapPoints{ MapType=1,MapID=2,Description="test1",X=347,Y=542,isActive=true},
    new MapPoints{ MapType=2,MapID=8,Description="test2",X=348,Y=543,isActive=true},
    new MapPoints{ MapType=3,MapID=7,Description="test3",X=346,Y=544,isActive=true},
    new MapPoints{ MapType=4,MapID=8,Description="test4",X=344,Y=545,isActive=true},
    new MapPoints{ MapType=5,MapID=6,Description="test5",X=342,Y=546,isActive=true},
    };
                    BindStore();
                }
            }
    
    
            protected void ImageMainMap_Click(object sender, ImageClickEventArgs e)
            {
                MapPoints obj = new MapPoints { MapType = 6, MapID = 6, Description = "test6", X = 442, Y = 646, isActive = true };
                listPoints.Add(obj);
                BindStore();
            }
    
    
    
    
            private void BindStore()
            {
                StrALEMaps.DataSource = this.listPoints;
                this.StrALEMaps.DataBind();
            }
    
    
            public class MapPoints
            {
                public int MapType
                {
                    get;
                    set;
                }
                public int MapID
                {
                    get;
                    set;
                }
                public string Description
                {
                    get;
                    set;
                }
                public int X
                {
                    get;
                    set;
                }
                public int Y
                {
                    get;
                    set;
                }
                public Boolean isActive
                {
                    get;
                    set;
                }
            }
        }
    }
    Please let us know your thoughts.....

    Thanks & Regards
    Mohan
    Last edited by Daniil; Sep 02, 2013 at 12:25 PM. Reason: Please use [CODE] tags
  4. #4
    Please edit your last post and add [CODE] tags around your code sample.
    Geoffrey McGill
    Founder & CEO
  5. #5
    Dear Geoffrey,

    When I am coping the code the format is absolutely right, after posting the thread it is not showing in formatted manner :(.

    Sorry to troubling you.

    Regards
    Mohan
  6. #6
    Quote Originally Posted by mohan.bizbites View Post
    When I am coping the code the format is absolutely right, after posting the thread it is not showing in formatted manner :(.
    How about you just add [CODE] tags around your code samples?

    Please see #3:
    http://forums.ext.net/showthread.php?10205
    Geoffrey McGill
    Founder & CEO
  7. #7
    UpdatePanel can updates controls inside own body only. Store is outside update panel therefore data is not rebound.
    I don't see the reason to use UpdatePanel. X and Y click coordinates can be passed with Ext.Net image button as extra parameters
    <Click OnEvent="MyEventHandler" Delay="0">
                    <ExtraParams>
                        <ext:Parameter Name="X" Value="e.getX() - this.el.getX()" Mode="Raw" />
                        <ext:Parameter Name="Y" Value="e.getY() - this.el.getY()" Mode="Raw" />
                    </ExtraParams>
                </Click>
    Vladimir Shcheglov
    Sr. Developer

Similar Threads

  1. Replies: 6
    Last Post: May 15, 2013, 10:07 AM
  2. Replies: 1
    Last Post: Aug 12, 2012, 7:32 AM
  3. Replies: 6
    Last Post: Jan 08, 2012, 4:06 AM
  4. Partial Post Back
    By hardik in forum 1.x Help
    Replies: 2
    Last Post: Apr 13, 2011, 4:46 AM
  5. grid panel data lost after post back
    By hassaannasir in forum 1.x Help
    Replies: 1
    Last Post: May 19, 2010, 7:09 AM

Posting Permissions