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:
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:
and the working title code on the backend is:
Any ideas that may avoid the javascript? Or is javascript a necessity in this case?
Thanks in advance.
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> |
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> |
| 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.
