Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
262 views
Hi,

The topic is a bit simplistic tbh, so i'll exlpain more in detail.

I have a RadGrid defined as follows:
<telerik:RadGrid ID="CovenantRadGrid" runat="server" AllowFilteringByColumn="True"
                                    AllowPaging="True" AllowSorting="True" CellSpacing="0" DataSourceID="ProjectCovenantListingDataSource"
                                    GridLines="None" Skin="Office2007" ClientSettings-EnablePostBackOnRowClick="true"
                                    OnPreRender="CovenantRadGrid_PreRender" OnItemCommand="CovenantRadGrid_ItemCommand"
                                    AllowAutomaticDeletes="true" OnItemDeleted="CovenantRadGrid_ItemDeleted" OnItemDataBound="CovenantRadGrid_ItemDataBound">
                                    <GroupingSettings CaseSensitive="false" />
                                    <ClientSettings EnableRowHoverStyle="true">
                                        <Selecting AllowRowSelect="True" />
                                        <ClientEvents OnRowClicking="OnRowClicking" OnRowClicked="OnRowClicked" OnCommand="OnRowCommand" />
                                    </ClientSettings>
.....

I also have a formview in the page right under the Radgrid. When I click on a row in the radgrid, I retrieve the necessary information and then use it to load the complete data of my row in the formview.
I do this by catching the "RowClick" command in the ItemCommand event on the server.

In addition, the formview data can become modifiable if I click on an "Edit" button that I have on my page.

When I'm editing the data, if the user clicks on another row of the grid, I need to provide the user with a warning using RadConfirm to warn him/her that the data they entered will be lost.

I implemented that functionality for Menu items on the page, as well as for RadButtons on the page (where necessary), but I am having trouble implementing this for the grid.

Here's the javascript code for the client methods:

var isRowSelected = "false";
            function OnRowSelecting(sender, eventArgs) {
                try {
                    var confirmExit = confirmExitKey;
                    if (confirmExit == "True") {
                        if (isRowSelected == "false") {
                            eventArgs.set_cancel(true);
                            var row = sender;
 
                            function CallBackFn(arg) {
                                if (arg) {
                                    isRowSelected = "true";
                                    row.select();
                                }
                            }
 
                            radconfirm('<%= GetGlobalResourceObject("GlobalResources", "E009") %> \n\n<br><br>', CallBackFn, 350, 120, null, 'Discard Changes?');
                        }
                    }
                }
                catch (ex) {
                }
            }
 
            function OnRowSelected(sender, eventArgs) {
                //reset the isAddButtonClicked variable
                isRowSelected = "false";
            }
 
            var isRowCommandFired = "false";
            function OnRowCommand(sender, eventArgs) {
                try {
                    var itemIndex = itemIndex = eventArgs.get_commandArgument();
 
                    if (eventArgs.get_commandName() == "RowClick") {
                        var confirmExit = confirmExitKey;
                        if (confirmExit == "True") {
                            if (isRowCommandFired == "false") {
                                eventArgs.set_cancel(true);
                                var row = sender;
 
                                function CallBackFn(arg) {
                                    if (arg) {
                                        isRowCommandFired = "true";
                                        var masterTable = $find("<%= CovenantRadGrid.ClientID %>").get_masterTableView();
                                        masterTable.fireCommand("RowClick", itemIndex);
                                        isRowCommandFired = "false";
                                    }
                                }
 
                                radconfirm('<%= GetGlobalResourceObject("GlobalResources", "E009") %> \n\n<br><br>', CallBackFn, 350, 120, null, 'Discard Changes?');
                            }
                        }
                    }
                }
                catch (ex) {
                }
            }

For clarification:

The ConfirmExit variables are set in the code behind when I go into edit mode. It's a variable used to detect if i need to display the confirm box or not.

I'm having 2 issues with the above code:

In the RowSelecting method, eventArgs.set_cancel(true) does nothing. The command is fired still and the code behind is executed. I have a feeling this is normal because the event is firing anyways, correct?

This caused me to try and implement the RowCommand method. My problem with that one is that the client-side event never seems to be fired, even when I disable the RowSelecting and RowSelected events.

I hope this was clear enough...

Any ideas?

Thank you.
blablabla
Top achievements
Rank 1
 asked on 13 Jan 2012
1 answer
72 views
Hi, just to let you know there is a typo in RadEditor.Tools.de-DE.resx (Q3/2011):
Clipboard should read "Zwischenablage" not "Swischenablage"

Regards

Thomas
Rumen
Telerik team
 answered on 13 Jan 2012
3 answers
258 views
Hi,

In my application, we are using multiple rad windows and they have maximize and minimize buttons. if you click on minimize button of the inactive window, nothing is happening, we need to activate the window and click the minimize button and user will not like this, can you help us to activate the window on mouseover event ?

or

it will be great if it is possible to make all the window active.

Thanks
Venkat
Marin Bratanov
Telerik team
 answered on 13 Jan 2012
1 answer
96 views
Hi,

Is it possible to force the editor to use span tags with respective styles instead of deprecated tags without using the content filters? What I want to do is for example when selecting text and press the strike button instead of:

 <strike>selected text</strike>

use directly:

<span style="text-decoration: line-through">selected text</span>


Or is there any way to keep the editor selection between requests??

Thanks in advance,
Michael Pinheiro
Rumen
Telerik team
 answered on 13 Jan 2012
3 answers
153 views
Hi All,

Here's what I have:

  1. A "host" page that houses my RadWindowManager, et. al.
  2. The "host" page launches a RadWindow client side.
  3. On occasion, I need to launch a RadAlert from the RadWindow.
  4. I need to launch that RadAlert from the code behind.

I think I am pretty close, by using this article: http://www.telerik.com/help/aspnet-ajax/window-programming-opening-from-within-dialog.html

However, I am having a hell of a time calling the JavaScript from the code behind in this instance.  Here's what I have tried so far:

Dim script As String = "<script language='javascript' type='text/javascript'>Sys.Application.add_load(MyRadAlert);</script>"
 
Me.Page.ClientScript.RegisterStartupScript(Me.[GetType](), "", script)

I've also tried about 15 variations of that.  

Thanks so much for any guidance that you can give me.

Jim
Marin Bratanov
Telerik team
 answered on 13 Jan 2012
3 answers
111 views
Hi There

I have just installed the ASP.NET controls (12th Jan 2012) and the RadRotator is missing from all the lists of control in the VS Toolbox.  In fact there are a few controls missing from what I can see, the Ticker, Ribbon and a few more but the Adrotator is really what I need right now.

Any help appreciated. Many thanks

Dave
Richard
Top achievements
Rank 1
 answered on 13 Jan 2012
2 answers
155 views
I finally figured out the process of creating and adding the custom skin assembly and have it work by studying your attached zip file (http://www.telerik.com/community/code-library/aspnet-ajax/general/how-to-load-skins-from-external-assemblies.aspx). My question is how do I add my custom skin to the list of defined skins that ship in telerik's version of Telerik.web.ui.skins. If I reference telerik's dll in the assembly then my custom skin doesn't show in the skin chooser. If I reference telerik's dll in the web reference list then I also loose the custom skin. How do you combine the both the telerik predefined skins and the custom skin together so they all show up in the chooser drop down list?

dhuss
Top achievements
Rank 1
 answered on 13 Jan 2012
6 answers
215 views
Hi,
I have RadComboBox
<telerik:RadComboBox ID="combo" runat="server" OnItemDataBound="ItemDataBound" AllowCustomText="true" <br>                         EnableTextSelection="true"<br>                         EnableEmbeddedBaseStylesheet="true"<br>                         ChangeTextOnKeyBoardNavigation="true" <br>                         CollapseAnimation-Type="InCubic" <br>                         DropDownWidth="298px"<br>                         EnableScreenBoundaryDetection="true" <br>                         MarkFirstMatch="true"<br>                         NoWrap="False" <br>                         Filter="None"<br>                         CausesValidation="false"<br>                         IsCaseSensitive="false" <br>                         EmptyMessage="--All--"<br>                         ShowDropDownOnTextboxClick="true" <br>                         HighlightTemplatedItems="True"<br>                         EnableLoadOnDemand="True"<br>                         ShowMoreResultsBox="True"<br>                         ShowToggleImage="True"<br>                         EnableVirtualScrolling="True"<br>                         OnItemsRequested="OnItemRequested"<br>                         OnClientSelectedIndexChanged="multiSelectedIndexChanged"<br>                         Height="200px"<br>                         Width="145px"><br></telerik:RadComboBox>

witch use the following methods for data loading:
  
protected void OnItemRequested(object sender, RadComboBoxItemsRequestedEventArgs e)<br>        {<br>            IList list = DataSourceFunc != null ? DataSourceFunc(e.Text) : new ArrayList();<br>            if (GetEmptyItem != null && list.Count > 0)<br>            {<br>                list.Insert(0,GetEmptyItem());<br>            }<br>            int itemsPerRequest = ConfigCaller.DropDownPortionSize;<br>            int startOffset = e.NumberOfItems;<br>            int endOffset = Math.Min(startOffset + itemsPerRequest, list.Count);<br>            var data = GetPortion(list, Math.Max(0, startOffset - 1), endOffset - Math.Max(0, startOffset - 1));<br>            if (data.Count > 0)<br>            {<br>                combo.ClearSelection();<br>                combo.DataSource = data;<br>                combo.DataBind();<br>                if (!String.IsNullOrEmpty(EmptyClass) && GetEmptyItem != null)<br>                {<br>                    combo.Items[0].Attributes.Add("style", EmptyClass);<br>                }<br>            }<br>            e.Message = list.Count > 0 ? String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset, list.Count) : "No matches";<br>            e.EndOfItems = endOffset == list.Count;<br>            <br>        }<br><br>        private IList GetPortion(IList list, int start, int count)<br>        {<br>            var result = new ArrayList();<br>            for (int index = 0; index < list.Count; index++)<br>            {<br>                var item = list[index];<br>                if (index >= start && index < start + count)<br>                {<br>                    result.Add(item);<br>                }<br>            }<br>            return result;<br>        }
But when I open it i see only loading message whitch never hides. If i close it and open it again I see all valid items immidetly but still see load message on the top of combobox. I looked on it behavior on such tools like fiddler2 and firebug and pointed out that once opened it sends requests to the server each ~500ms and they returned with 200 ok result and valid response but combobox continue requests sending. I don't have any errors or exceptions on both client and server side and any entries in windows event log. Has anybody the same problems or knows how to fix this strange behaviour or what can it cause?
Ivana
Telerik team
 answered on 13 Jan 2012
2 answers
93 views
rcalDateRange.RangeSelectionStartDate
rcalDateRange.RangeSelectionEndDate 

These properties used to work in the old telerik DLL... Now it says Telerik.Web.UI.RadCalendar does not contain a definition for them... What gives?

Levi
Levi
Top achievements
Rank 1
 answered on 13 Jan 2012
0 answers
174 views
Hi,

I have a requirement where we have two buttons 
First Button for export the Grid to PDF/Excel. 
second button for send email (custom email form shown in RadWindow)

For Export To PDF we are using custom PDF Code where we have used abcpdf7.0, (for Proper CSS & Word wraping) for excel we are using radgrid..MasterTableView.ExportToExcel()

We have used PdfExporting event as we want to suppress the export pdf for telerik & show our own pdf that we are generating.
protected void rgdEthnicityReport_PdfExporting(object sender, Telerik.Web.UI.GridPdfExportingArgs e)
       {
           if (isPdfExport)
           {
               GeneratePdfDocument(e.RawHTML);
           }
           else
           {
               Session["HTMLContent"] = e.RawHTML;
           }
             
       }

GeneratePDFDocument is custom method that we have written. Below is the code
private void GeneratePdfDocument(string htmlContent)
        {
            try
            {
                this.PDF = new Doc();
                PDF.Rect.Inset(10, 50);
                this.PDF.HtmlOptions.Timeout = 600000;
                this.PDF.HtmlOptions.RetryCount = 2;
                int pdfID;
                PDF.TopDown = true;
                pdfID = this.PDF.AddImageHtml(htmlContent);
  
                while (true)
                {
                    if (this.PDF.Chainable(pdfID) == false)
                        break;
                    this.PDF.Page = PDF.AddPage();
  
                    pdfID = this.PDF.AddImageToChain(pdfID);
                }
  
                object pdfObject = this.PDF.GetData();
  
                HttpContext.Current.Response.Clear();
                HttpContext.Current.Response.ContentType = "application/pdf";
                HttpContext.Current.Response.AddHeader("Content-Type", "application/pdf");
                HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + "Ethnicity Summary Report" + ".pdf");
                HttpContext.Current.Response.ContentType = "application/octet-stream";
                HttpContext.Current.Response.BinaryWrite((byte[])pdfObject);
                this.PDF.Clear();
                HttpContext.Current.Response.End();
            }
            catch (EHRExceptions ex)
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "excAlert", "$(document).ready(function(){jAlert('" + Utility.ContentFetcher.GetValidationMessage("GREX_1", BOL.Classes.EHRSessions.Culture) + "');});", true);
                Utility.MailSender.ExceptionLogger(log, ex.ErrorCode, BOL.Classes.EHRSessions.ClinicId, BOL.Classes.EHRSessions.UserId, ex.Message, ex.GetBaseException());
            }
}


On second button "Send Email" I need only RawHTMl and then call RadWindow to show our custom form for sending email.
To do this we have kept a Flag isPdfExport so that it stores the RawHtml in session.

On send Email Button Click below code is used.
protected void rbtnSendMail_Click(object sender, EventArgs e)
        {
            if (NeedRedirection || WasSessionEnd()) return;
            try
            {
                isPdfExport = false;
                this.rgdEthnicityReport.MasterTableView.ExportToPdf();
                string Intext = "false";
                string letterName = "Ethnicity Summary Report";
  
                RadWindow1.NavigateUrl = "~/Patient/Management/ReportEmailing.aspx";
                RadWindow1.NavigateUrl += "?InText=" + Intext + "&LetterName=" + letterName + "&EmailCategory=Report";
                RadWindow1.Title = "Ethnicity Summary Report";
                RadWindow1.Visible = true;
                RadWindow1.VisibleOnPageLoad = true;
  
            }
            catch (EHRExceptions ex)
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "excAlert", "$(document).ready(function(){jAlert('" + Utility.ContentFetcher.GetValidationMessage("GREX_1", BOL.Classes.EHRSessions.Culture) + "');});", true);
                Utility.MailSender.ExceptionLogger(log, ex.ErrorCode, BOL.Classes.EHRSessions.ClinicId, BOL.Classes.EHRSessions.UserId, ex.Message, ex.GetBaseException());
            }
}


We are callingthis.rgdEthnicityReport.MasterTableView.ExportToPdf(); so that pdfexporting event is called and we get RawHtml in the session (due to isPDFExport set to false. I have issue over here, It is not showing our Window for sending email & showing the pdf exported by telerik. I want to suppress this & getonly RawHtml & then execute our code for sending email by showing radwindow. We also tried moving code from send email to pdfexporting block but same issue.

Please suggest how to achieve this.

Thanks.

Hiren
Top achievements
Rank 1
 asked on 13 Jan 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?