[CLOSED] Based on the row selection Iframe should refresh/postback with new selected data (URL).

Page 1 of 3 123 LastLast
  1. #1

    [CLOSED] Based on the row selection Iframe should refresh/postback with new selected data (URL).

    Hi,


    I have two panels, one panel contains gridpanel and other contains Iframe.

    If I select the row one of the record contains a URL based on the row selection the Iframe should refresh/postback with new selected data (URL)

    But currently its not refreshing/posting back (not calling the iframe src "abc.aspx")

    Please note : our Page loads completely dynamic we cannot find out single control also in markup page(aspx page).

    Thanks,
    vamsi.
    Last edited by Daniil; May 30, 2015 at 2:24 PM. Reason: [CLOSED]
  2. #2
    Hi @Vamsi,

    But currently its not refreshing/posting back (not calling the iframe src "abc.aspx")
    Please demonstrate how do you reload the page?

    Actually, a full runnable test case to reproduce the problem is appreciated.
  3. #3
    Thank You!!!

    Let me explain about how we do..

    In our application all the controls will generate on the fly along with events,validations and soon..

    our code is generic So that's the reason I'm unable to provide code ,if I provide code very difficult to figure it out.

    Here we have one gridpanel and one Iframe (I frame loads different aspx page based on the selected row the details of the row will pass to the aspx page and render the page).

    Based on the every row selection Iframe has to refresh (call the Viewer.aspx)

    Below Iframe src:

    ViewerIFrame = new HtmlGenericControl("iframe");
     ViewerIFrame.ID = fieldList[i].Name;
     ViewerIFrame.Attributes["height"] = Convert.ToString((fieldList[i].Height) * Constants.scaleY);
                                    ViewerIFrame.Attributes["frameBorder"] = "0";
                                    ViewerIFrame.Attributes["scrolling"] = "no";
    ViewerIFrame.Attributes["src"] = "Viewer.aspx?Path=" + Server.UrlEncode(Convert.ToString(Selected data)) 
    
    Placeholder2.Controls.Add(ViewerIFrame);
    Based on the query string the data will fetch from the database and update the same in Iframe.

    above Logic will work if we use Asp.net controls but when integrate the ext.net control(only grid panel) .


    Thanks,
    Vamsi.
    Last edited by Daniil; Apr 27, 2015 at 8:13 PM. Reason: Please use [CODE] tags
  4. #4
    Sorry, I still don't see (or don't understand) how you update the iframe.

    our code is generic So that's the reason I'm unable to provide code ,if I provide code very difficult to figure it out.
    You are right. The complex code might complicated the things.

    But what about to build a simple static test case that would reflect the real scenario that you are dealing with?
  5. #5
    Hi daniel,

    Thank you for the suggestion !

    Please find the row selection event of the grid panel:

    <ext:GridPanel ID="GridPanel1" runat="server" Title="" StoreID="Store1" SelectionMemory="false"
                                EnableViewState="true">                         
                                                                   
                                <SelectionModel>
                                    <ext:RowSelectionModel ID="RowSelectionModel1" runat="server">
                                        <DirectEvents>
                                            <Select OnEvent="GridPanel1_RowSelect">
                                                <ExtraParams>
                                                    <ext:Parameter Name="RowValues" Value="Ext.encode(#{GridPanel1}.getRowsValues({selectedOnly:true}))"
                                                        Mode="Raw" />
                                                </ExtraParams>
                                            </Select>
                                        </DirectEvents>
                                    </ext:RowSelectionModel>
                                </SelectionModel>                          
                            </ext:GridPanel>



    HtmlGenericControl ViewerIFrame = null;
    protected void Page_Load(object sender, EventArgs e)
            {
     ViewerIFrame = new HtmlGenericControl("iframe");
                                    ViewerIFrame.ID = fieldList[i].Name;
     ViewerIFrame.Attributes["height"] = Convert.ToString((fieldList[i].Height) * Constants.scaleY);
                                    ViewerIFrame.Attributes["frameBorder"] = "0";
                                    ViewerIFrame.Attributes["scrolling"] = "no";
    
    Placeholder2.Controls.Add(ViewerIFrame);
    }
    
    
    protected void GridPanel1_RowSelect(object sender, DirectEventArgs e)
            {
                if (isrowEditable == false)
                {
                    string RecData = string.Empty;
                    string valList = string.Empty;
                    string rowValues = e.ExtraParams["RowValues"]; //extra params
    
                    Dictionary<string, string>[] gridRows = JSON.Deserialize<Dictionary<string, string>[]>(rowValues);
    
                    string strName = "";
                    foreach (Dictionary<string, string> row in gridRows)
                    {
                        string insertedTxt = "";
                        foreach (KeyValuePair<string, string> kvp in row)
                        {
                            RecData =  kvp.Key  
                            valList =  kvp.Value ;
    
                        }
                    }
    
                  ViewerIFrame.Attributes["src"] = "WebOTViewer\\Viewer.aspx?Path=" + Server.UrlEncode(Convert.ToString(kvp.Value)) + "&FrameGroup=" + FrameGroup + "&height=" + FrameHeight + "&width=" + FrameWidth + "&isPercentage=" + IsPercentWidth;
                }
    
            }
    Thanks,
    Vamsi.
    Last edited by Vamsi; Apr 28, 2015 at 10:33 AM.
  6. #6
    @Vamsi, we would appreciate if you edit the post wrapping the code in [CODE] tags.

    Please see #3:
    http://forums.ext.net/showthread.php?10205
  7. #7
    Thank you.

    Please try to call ViewerIFrame.Update(); at the end of GridPanel1_RowSelect.

    Please note that a DirectEvent is an AJAX request, not a regular ASP.NET PostBack request. If you change an ASP.NET control during a DirectEvent, you should call something to force the changes to be affected on client. In your scenario an .Update() might do the job.
  8. #8
    Thanks Daniel,

    ViewerIframe is a HtmlGenericControl and sorry there is no update() method for the ViewerIframe .


    Please help me on this and it would be great if any work around .


    Thanks,
    Vamsi.
  9. #9
    There is the .Update() for me. The Ext.Net namespace must be imported.
    using Ext.Net;
    But never mind, I found out that an .Update() call doesn't work in this scenario.

    I can suggest the following solution.

    Example
    <%@ Page Language="C#" %>
    
    <script runat="server">
        HtmlGenericControl ViewerIFrame = null;
    
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                ViewerIFrame = new HtmlGenericControl("iframe");
                ViewerIFrame.Attributes["src"] = "http://ext.net";
                ViewerIFrame.Attributes["id"] = "myIframe";
    
                this.Form.Controls.Add(ViewerIFrame);
            }
        }
    
        protected void SetNewSrc(object sender, DirectEventArgs e)
        {
            X.Js.Set("myIframe.src", "http://bridge.net");
        }
    </script>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Ext.NET v3 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:Button runat="server" Text="Set new src" OnDirectClick="SetNewSrc" />
        </form>
    </body>
    </html>
  10. #10
    Sorry Daniel no luck..

    I added code to get some Idea how about the work flow.

    I'm using grdipanel user control and mainpage page.

    I have added below code in gridpanel Usercontrol

    
    <ext:GridPanel ID="GridPanel1" runat="server" Title="" StoreID="Store1" SelectionMemory="false"
                                EnableViewState="true">                         
                                                                   
                                <SelectionModel>
                                    <ext:RowSelectionModel ID="RowSelectionModel1" runat="server">
                                        <DirectEvents>
                                            <Select OnEvent="GridPanel1_RowSelect">
                                                <ExtraParams>
                                                    <ext:Parameter Name="RowValues" Value="Ext.encode(#{GridPanel1}.getRowsValues({selectedOnly:true}))"
                                                        Mode="Raw" />
                                                </ExtraParams>
                                            </Select>
                                        </DirectEvents>
                                    </ext:RowSelectionModel>
                                </SelectionModel>                          
                            </ext:GridPanel>
    
    
    protected void GridPanel1_RowSelect(object sender, DirectEventArgs e)
            {
                if (isrowEditable == false)
                {
                    string RecData = string.Empty;
                    string valList = string.Empty;
                    string rowValues = e.ExtraParams["RowValues"]; //extra params
    
                    Dictionary<string, string>[] gridRows = JSON.Deserialize<Dictionary<string, string>[]>(rowValues);
    
                    string strName = "";
                    foreach (Dictionary<string, string> row in gridRows)
                    {
                        string insertedTxt = "";
                        foreach (KeyValuePair<string, string> kvp in row)
                        {
                            RecData =  kvp.Key  
                            valList =  kvp.Value ;
    
                        }
                    }
    
                 if (ExtTestCustomEvent != null)
                            ExtTestCustomEvent(this, ceArgs); --->Bubbled event calling mainpage
                }
    
            }

    Please find mainpage code ..

    HtmlGenericControl ViewerIFrame = null;
    protected void Page_Load(object sender, EventArgs e)
            {
    
    addUserControl();
     ViewerIFrame = new HtmlGenericControl("iframe");
                                    ViewerIFrame.ID = fieldList[i].Name;
     ViewerIFrame.Attributes["height"] = Convert.ToString((fieldList[i].Height) * Constants.scaleY);
                                    ViewerIFrame.Attributes["frameBorder"] = "0";
                                    ViewerIFrame.Attributes["scrolling"] = "no";
    
    Placeholder2.Controls.Add(ViewerIFrame);
    }
    
    
    
    void uc2_ExtTestCustomEvent(object sender, CommandEventArgs e)
            {
                string args = "";// e.CommandName;
                string eArg = "";
                if (e.CommandArgument == null || (string)e.CommandArgument.ToString().Trim() == "")
                    eArg = "CommandClick";
                else
                    eArg = e.CommandArgument.ToString();
    
                OTEventArgs eArgs = new OTEventArgs(eArg, args);
                eArgs.Items = e.CommandName;
                eArgs.Sender = sender;
                ProcessEvent(sender, eArgs);
            }
    
    
    
     private void ProcessEvent(object sender, OTEventArgs e)
            {
    
    Ext.Net.X.Js.Set("ViewerIFrame.Attributes["src"] ", "WebOTViewer\\Viewer.aspx?Path=" + Server.UrlEncode(Convert.ToString(eArgs)) + "&FrameGroup=" + FrameGroup + "&height=" + FrameHeight + "&width=" + FrameWidth + "&isPercentage=" + IsPercentWidth);
    
       
    }
    
    
    Adding user control to mainpage:
    
    private void addUserControl(
    {
    
    OTExtGridview uc2 = (OTExtGridview)Page.LoadControl("~/UserControls/OTExtGridView.ascx");
                                        uc2.ExtTestCustomEvent += new OTExtGridview.ClickEventHandler(uc2_ExtTestCustomEvent);
    AsyncPostBackTrigger trg1 = new AsyncPostBackTrigger();
                                            trg1.ControlID = uc2.ID;
                                            trg1.EventName = "ExtTestCustomEvent";
                                            UpdatePanel1.Triggers.Add(trg1);
    }

    Please help me on this
    Last edited by Vamsi; Apr 30, 2015 at 9:39 AM.
Page 1 of 3 123 LastLast

Similar Threads

  1. Replies: 5
    Last Post: Jul 12, 2013, 3:29 PM
  2. Replies: 1
    Last Post: Dec 20, 2012, 7:30 AM
  3. Refresh GridPanel data on postback event
    By huzzy143 in forum 1.x Help
    Replies: 6
    Last Post: Sep 05, 2011, 7:55 PM
  4. Replies: 2
    Last Post: Aug 09, 2011, 10:38 AM
  5. [CLOSED] loading applet based page in iframe
    By yobnet in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 07, 2010, 2:41 AM

Tags for this Thread

Posting Permissions