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

Dynamic Modal Window Titles

2 Answers 127 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Assia
Top achievements
Rank 1
Assia asked on 24 Jun 2010, 08:15 PM
I'm currently trying to set a modal window title dynamically from my stored procedure search and it works fine when I add it to the <UpdateControls><telerik:AjaxUpdatedControl> but even though it displays as it should, the window refuses to close now. I tried setting an individual UpdateControl just for the modal window but that did not work as well. A friend of mine suggested somehow using JavaScript to $find("modalComment.ClientID"); but I've never coded in javascript so this poses a bit of an issue to me. Has anyone else tried to set a dyanamic modal window titles from the backend code were able to close the window successfully?
 What I currently have is:
            <telerik:AjaxSetting AjaxControlID="gvSearchResults">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="gvSearchResults" /> 
                    <telerik:AjaxUpdatedControl ControlID="modalComment" /> 
                    <telerik:AjaxUpdatedControl ControlID="rptComments" /> 
                    <telerik:AjaxUpdatedControl ControlID="modalStatus" /> 
                    <telerik:AjaxUpdatedControl ControlID="rptStatus" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
This displays my title and dynamic content just as is should.

In my actual column that I want to call the window from an image button:

<telerik:GridTemplateColumn UniqueName="Title" HeaderText="Title" InitializeTemplatesFirst="false" SortExpression="Title">  
                        <ItemTemplate> 
                            <table cellspacing="0" width="100%">  
                                <tr> 
                                    <%#Eval("Title") %> <asp:ImageButton ID="imgButton" runat="server" ImageUrl="~/images/icons/16/message_add.png" OnClick="fillModalComment" /> 
                                </tr> 
                            </table> 
                        </ItemTemplate> 
                        <ItemStyle HorizontalAlign="Left" /> 
                    </telerik:GridTemplateColumn> 
 and the working title code on the backend is:
        public void fillModalComment(object sender, EventArgs e)  
        {  
            int reqID = 0;  
            reqID = int.Parse(((ImageButton)sender).CommandArgument);  
 
            rptComments.DataSource = Comments.GetComments(reqID);  
            rptComments.DataBind();  
 
            MainSearch ms = new MainSearch(reqID);  
            string title = "Comments on " + ms.Title;  
 
            int len = ms.Title.Length;  
 
            if (title.Length < 40)  
                modalComment.Title = title;  
            else  
                modalComment.Title = title.Substring(0, 40) + "...";  
 
            modalComment.Show();  
        } 

Any ideas that may avoid the javascript? Or is javascript a necessity in this case?

Thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 30 Jun 2010, 04:38 PM
Hello Assia,

I am sending you a simple example which demonstrates the modal RadWindow. Please check it out and let me know if it helps you.
Also please check out the following online documentation article:
http://www.telerik.com/help/aspnet-ajax/window_behaviorshowingandpositioning.html
http://www.telerik.com/help/aspnet-ajax/window_programmingradwindowmethods.html
http://www.telerik.com/help/aspnet-ajax/window_programmingopening.html
http://www.telerik.com/help/aspnet-ajax/window_programmingsettingclienteventsusingjavascript.html
http://www.telerik.com/help/aspnet-ajax/window_programmingcallingfunctions.html
http://www.telerik.com/help/aspnet-ajax/window_programmingexecutingascriptonreload.html

I hope this helps.

Sincerely yours,
Radoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Assia
Top achievements
Rank 1
answered on 14 Jul 2010, 03:08 PM
Merci, mnogo mi pomogna! :)
Tags
Ajax
Asked by
Assia
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Assia
Top achievements
Rank 1
Share this question
or