This is a migrated thread and some comments may be shown as answers.

how to access parent grid template column in after closing radwindow

1 Answer 80 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Venkata
Top achievements
Rank 1
Venkata asked on 17 Jan 2014, 04:48 PM
Hello All,

I have Grid in the main screen, and i am having RadWindow to show popup. Our requirement is,  by default, in the main screen, we are using Blank(Outline) Flag image for opening Rad Window. After closing RadWindow, we want to change the Image Url, i.e., Colored Flag Image. how can we change the Url of Image, which is in Parent Grid Without Refreshing the Parent Grid?

Please have a look at below code:

//Grid Template Column in the Main Screen
 
<telerik:GridTemplateColumn UniqueName="imgTemplateColumn" InitializeTemplatesFirst="false" HeaderStyle-Width="70" HeaderText="Image" HeaderStyle-
                                 SortExpression="Image">
                        <ItemTemplate>
                            <asp:ImageButton ID="imgbOutline" runat="server" ImageUrl="~/Images/flag_outline.png"/>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>


<%-- Declaring RadWindow Pop-up for General Data--%>
                <telerik:RadWindow ID="GeneralData" runat="server" Title="General Data" Height="650px"
                    Width="800px" Left="150px" ReloadOnShow="true" ShowContentDuringLoad="false"
                    Modal="true" NavigateUrl="frmMainScreen.aspx" Behaviors="Close">
                </telerik:RadWindow>

// To show the GeneralData Popup
            function ShowGeneralDataPopUp(id, t, rowIndex) {
                var grid = $find("<%= grdProduct.ClientID %>");
                var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();
                grid.get_masterTableView().selectItem(rowControl, true);
                window.radopen("popGeneralData.aspx?RecNo=" + id + "&f=" + t + "&RowIndex=" + rowIndex, "GeneralComments");
                return false;
            }

protected void grdProduct_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
    ImageButton imgbOutline = (ImageButton)e.Item.FindControl("imgbOutline");       // Getting GeneralComments Link
                imgbOutline.Attributes["href"] = "javascript:void(0);";
                imgbOutline.Attributes["onclick"] = String.Format("return ShowGeneralComments('{0}','{1}', '{2}');", intRecNo, "GeneralData", e.Item.ItemIndex);
 
}

// After Closing the RadWindow the below Javascript method is going to call
 
function CloseAndRebind(args) {
                GetRadWindow().BrowserWindow.refreshGrid(args);
                GetRadWindow().close();
 
    //How can I access ImageButton of Parent Grid
                //parent.document.getElementById(‘imgbOutline’)
 
            }

Please give suggestions, how can we change the Url of Image, which is in Parent Grid Without Refreshing the Parent Grid.

Thanks In Advance.

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 22 Jan 2014, 11:08 AM
Hello Venkata,

For getting reference to the image input element on the client-side close event of the RadWindow you could add an attribute (with the row index) to the window's element after you have opened it and then on the ClientClose event to access that attribute. Once you have the row index you could get the corresponding data item from the masterTableView and find the ImageButton element with $telerik.findElement() method.

For your convenience I have prepared a sample page with the desired functionality. Please try the attached files and see if the result meets your requirements.


Regards,
Konstantin Dikov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Venkata
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or