Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
95 views
I found that the radupload gets translated into  a series of input tags.

the input type=file is just  chilling at  position: absolute; left: 0px; top: -5000px;  

this happens while the hover over is not fired.

The problem with this is that my page is rather large and -5000 px before the upload
is some checkbox

So when i click on the checkbox a File browse fires and i'm prompted to upload
a file instead of just checking the  current checkbox. 

Is there a fix for this?  I tried hiding the input but that renders the control useless.


Bozhidar
Telerik team
 answered on 06 Feb 2012
10 answers
399 views
Hi

I have a RadGrid with Master and Detail views.  The load mode for the details view is HierarchLoadMode="ServerOnDemand".  I am binding the details view on the RadGrid DetailTableDataBind event.

I am trying to set the value of one of the detail fields to a value from the master table view but can't figure out how to get a reference to the detail row/field  being bound. 

 

Thank you for your assistance

Tracy

Private Sub rgvDataExceptions_DetailTableDataBind(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridDetailTableDataBindEventArgs) Handles rgvDataExceptions.DetailTableDataBind
        Dim SelectedRow As GridDataItem = CType(e.DetailTableView.ParentItem, GridDataItem)
        Dim intException As Int32 = SelectedRow.GetDataKeyValue("ExceptionID")
        Dim detailTable As GridTableView = DirectCast(SelectedRow.ChildItem.NestedTableViews(0), GridTableView)
        SQLDS_DataExceptionsMessage.SelectParameters.Clear()
        SQLDS_DataExceptionsMessage.SelectParameters.Add("intExceptionId", intException)
        e.DetailTableView.DataSource = SQLDS_DataExceptionsMessage
                  'Get value from master table row
        Dim strExceptionMessage As String = SelectedRow("ExceptionMessage").Text 

            I would then like to set the bltExceptionMessage,which is a bulled list that is in a template column of the details view

        
'Dim bltMessages As BulletedList = DirectCast(SelectedRow.FindControl("bltExceptionMessage"), BulletedList)
        'Dim aryMessages As New ArrayList
  
        'aryMessages.AddRange(Split(strExceptionMessage, "~"))
        'bltMessages.DataSource = aryMessages
        'bltMessages.DataBind()
  
  
    End Sub
 

 

Andrey
Telerik team
 answered on 06 Feb 2012
3 answers
311 views
I originally posted this as a reply to a year old post.

I have a RadWindowManager with DestroyOnClose='true' but on every postback, even after closing the window theRadWindowManager's Windows collection still contains the window. I do not have VisibleOnPageLoad set. Instead, on every load, I run the following javascript.

function openPromoteWindows(RadWindowManagerId) {
    var oManager = $find(RadWindowManagerId);
    var oWindows = oManager.GetWindows();
    for (i = 0; i < oWindows.length; i++) {
        var oWindow = oWindows[i];
        oWindow.show();
        oWindow.Minimize();
        oWindow.get_popupElement().style.zIndex = 10000 + i;
    }
}

This successfully opens all the windows minimized inside a taskbar. The problem is that since closed windows are still in the Windows Collection, they reappear.

I did write some code called "OnClientClose that does successfully delete the window from the windows collection on the client side, but it doesn't persist. That code is below:

function rwmPromote_Close(sender, eventargs) {
    var rwm = $find(window['rwmPromoteId']);
    var oWindows = rwm.GetWindows();
    var i;
    for (i = 0; i < oWindows.length; i++) {
        var oWindow = oWindows[i];
        if (oWindow == sender)
            break;
    }
    if (i < oWindows.length) {
        rwm._windows.splice(i, 1);
    }
}

This code was added in desperation to try and get the information persisted to the server side. I tried setting EnableViewState to false, but as expected that makes it forget about all Windows in the Windows collection except for ones added during that postback, which means it does forget about closed windows but also forgets about minimized windows.

I am about to add a HiddenField which will contain the ClientIDs of all Windows and then I will use that server side to deduce which windows, if any, were closed. While I am hopeful this will work, I am sure it's not the way it is supposed to work.

Added later! I have implemented the HiddenField solution as follows and it works successfully, but I don't think this is the proper way to achieve my goal.

function rwmPromote_Close(sender, eventargs) {
    var rwm = $find(window['rwmPromoteId']);
    var hf = $get(window['hfWindowIdsId']);
    hf.value = '';
    var oWindows = rwm.GetWindows();
    var i;
    for (i = 0; i < oWindows.length; i++) {
        var oWindow = oWindows[i];
        if (oWindow == sender)
            break;
    }
    if (i < oWindows.length) {
        rwm._windows.splice(i, 1);
        oWindows = rwm.GetWindows();
        for (i = 0; i < oWindows.length; i++) {
            hf.value += oWindows[i].id + ',';
        }
    }
}
 
and in the code behind.

// At the conclusion of every postback
  
hfWindowIds.Value = "";
foreach (RadWindow rw in rwmPromote.Windows)
{
    hfWindowIds.Value += rw.ClientID + ',';
}
 
// And then on the ValueChanged event for the HiddenField
 
        protected void hfWindowIds_ValueChanged(object sender, EventArgs e)
        {
            char[] sep = {','};
            string[] WindowIds = ((HiddenField)sender).Value.Split(sep, StringSplitOptions.RemoveEmptyEntries);
            List<RadWindow> rwList = new List<RadWindow>();
            foreach (RadWindow rw in rwmPromote.Windows)
            {
                if (!WindowIds.Contains(rw.ClientID)) rwList.Add(rw); // No longer open client side
            }
            foreach (RadWindow rw in rwList)
                rwmPromote.Windows.Remove(rw);  // Remove each closed window
        }
    }

This is all working, but I would pre3fer to know the "correct" way to achieve my goal.

Martin

Suggestions welcomed!!
Marin Bratanov
Telerik team
 answered on 06 Feb 2012
7 answers
324 views
I am trying to horizontally align specific cells when exporting the same as their ItemStyle in the markup.  I've followed several links and have it working for Excel but PDF does not.

The ExportCellFormatting event handler does not appear to fire when exporting to PDF like it does for Excel.  I believe this event is supposed to be a replacement for the deprecated ExcelExportCellFormatting event, but I would think based off the name and the deprecation of its predecessor that this should fire for PDFs as well.

ExportCellFormatting is the only event that I've found thus far where the cell's HorizontalAlign is set (off the e.FormattedColumn.ItemStyle) -- if I check the cell's HorizontalAlign in either the ItemCreated or ItemCommand event handlers it is always HorizontalAlign.NotSet.  The PdfExporting event only exposes the raw HTML, which I can manipulate, but that is tedious.

I am able to get basic formatting to occur for PDF so long as it isn't related to checking something set in the markup.  For example, I can detect whether the ItemType is an Item or AlternatingItem and set the inline style accordingly for alternating rows, and set the basic font, font size, and header formatting.

How can I format what's exported to PDF based on the formatted columns, specifically the horizontal alignment of individual cells?  Below are code samples of what I have working so far.

    <jha:RadGrid ID="grdVendors" runat="server" DataSourceID="odsVendors"
        OnItemDataBound="grdVendors_ItemDataBound" OnItemCommand="grdVendors_ItemCommand"
        OnExportCellFormatting="grdVendors_ExportCellFormatting" OnItemCreated="grdVendors_ItemCreated" OnPdfExporting="grdVendors_PdfExporting">
        <MasterTableView DataKeyNames="VendorID">
            <Columns>
                <telerik:GridBoundColumn HeaderText="ID" DataField="VendorID" Visible="false" />
                <telerik:GridBoundColumn HeaderText="First Name" DataField="FirstName" />
                <telerik:GridBoundColumn HeaderText="Last Name" DataField="LastName" />
                <telerik:GridBoundColumn HeaderText="City" DataField="City" />
                <telerik:GridBoundColumn HeaderText="State" DataField="State" ItemStyle-HorizontalAlign="Center" />
                <telerik:GridBoundColumn UniqueName="CreatedOn" HeaderText="Created On" DataField="CreatedDateTime"
                    DataFormatString="{0:MM/dd/yyyy}" ItemStyle-HorizontalAlign="Right" />
            </Columns>
        </MasterTableView>
    </jha:RadGrid>

protected void grdVendors_ItemCommand(object sender, GridCommandEventArgs e)
{
    switch (e.CommandName)
    {
        case RadGrid.ExportToExcelCommandName:
        case RadGrid.ExportToPdfCommandName:
            grdVendors.CssClass = "export";
            string title = "Foo";
 
            GridExportSettings settings = grdVendors.ExportSettings;
            settings.ExportOnlyData = true;
            settings.OpenInNewWindow = true;
            settings.IgnorePaging = true;
            settings.HideStructureColumns = true;
            settings.FileName = string.Format("{0} {1:yyyy-MM-dd}", title, DateTime.Now);
 
            // PDF
            settings.Pdf.DefaultFontFamily = "Tahoma";
            settings.Pdf.PageTitle = title;
            settings.Pdf.Title = title;
            settings.Pdf.AllowPrinting = true;
            settings.Pdf.AllowAdd = false;
            settings.Pdf.AllowCopy = true;
            settings.Pdf.AllowModify = false;
            settings.Pdf.PaperSize = GridPaperSize.A4;
            settings.Pdf.PageHeight = Unit.Parse("210mm");
            settings.Pdf.PageWidth = Unit.Parse("297mm");
            settings.Pdf.PageTopMargin = Unit.Parse("20mm");
            settings.Pdf.PageHeaderMargin = Unit.Parse("10mm");
            settings.Pdf.PageBottomMargin = Unit.Parse("10mm");
            settings.Pdf.PageLeftMargin = Unit.Parse("10mm");
            settings.Pdf.PageRightMargin = Unit.Parse("10mm");
            break;
    }
}
 
protected void grdVendors_ExportCellFormatting(object sender, ExportCellFormattingEventArgs e)
{
    /// Never fires when exporting to PDF
    switch (e.FormattedColumn.ItemStyle.HorizontalAlign)
    {
        case HorizontalAlign.Left:
            e.Cell.Style["text-align"] = "left";
            break;
        case HorizontalAlign.Center:
            e.Cell.Style["text-align"] = "center";
            break;
        case HorizontalAlign.Right:
            e.Cell.Style["text-align"] = "right";
            break;
    }
 
    if (e.FormattedColumn.UniqueName == "PostalCode")
        e.Cell.Style["mso-number-format"] = @"\@";
}
 
protected void grdVendors_ItemCreated(object sender, GridItemEventArgs e)
{
    if (grdVendors.CssClass.Contains("export"))
    {
        if (e.Item is GridDataItem)
        {
            foreach (TableCell cell in e.Item.Cells)
            {
                if (e.Item.ItemType == GridItemType.AlternatingItem)
                    cell.Style["background-color"] = "#E6EFF7";
                else
                    cell.Style["background-color"] = "#FFFFFF";
            }
        }
        else if (e.Item is GridHeaderItem)
        {         
            Table table = e.Item.Parent.Parent as Table;
            table.Style["font-family"] = "Tahoma";
            table.Style["font-size"] = "8pt";
 
            foreach (TableCell cell in e.Item.Cells)
            {
                cell.Style["border-color"] = "#FFFFFF";
                cell.Style["background-color"] = "#EEEEEE";
                cell.Style["text-align"] = "left";
                cell.Style["color"] = "#274777";
                cell.Style["font-weight"] = "bold";
            }
        }
    }
}


Regards,
Tim

Andrey
Telerik team
 answered on 06 Feb 2012
3 answers
176 views
In a production environment currently we are running into an issue where when we have RadCompression enabled our AJAX calls that our RadGrids make are failing and causing our page to be unusable. 

This is only happening in the production environment and not our dev/staging.

Server Information:
Server 2008 R2
64 BIT 
IIS 7.5.7600.16385
Telerik Version: 2011.2.712.40

Event code: 3005

Event message: An unhandled exception has occurred.

Event time: 1/25/2012 9:56:43 AM

Event time (UTC): 1/25/2012 2:56:43 PM

Event ID: 234287b000864dfeadd74c5105b467c8

Event sequence: 75

Event occurrence: 1

Event detail code: 0

 

Application information:

    Application domain: /LM/W3SVC/8/ROOT-1-129719554943999466

    Trust level: Full

    Application Virtual Path: /

    Application Path: e:\inetpub\site

    Machine name: 

 

Process information:

    Process ID: 12760

    Process name: w3wp.exe

    Account name: 
 

Exception information:

    Exception type: NullReferenceException

    Exception message: Object reference not set to an instance of an object.

   at Telerik.Web.UI.RadCompression.Compress(HttpApplication application)

   at Telerik.Web.UI.RadCompression.PreRequestHandlerExecute(Object sender, EventArgs e)

   at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()

   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)






I'm trying to find out if this is a known issue with a good work around.  If more information is needed please let me know.
BabaYa
Top achievements
Rank 1
 answered on 06 Feb 2012
1 answer
69 views
I am working with the RadSplitter, and I have the following requirement:

<RadSplitter>
<RadToolBar> - spans across entire width of RadSplitter
<RadPane Width="20%" />
<RadSplitBar />
<RadPane Width="80%" />
</RadSplitter>

Is it possible to have a RadToolBar span the entire length of a RadSplitter at the top, with two RadPanes below the RadToolBar?
 
- similiar to how an html table can be customized;

Thanks in advance for any insight;
Dobromir
Telerik team
 answered on 06 Feb 2012
7 answers
278 views
hi all,


I need to show confirmation when closing window. how to do ?



thanks,
benjamin
Marin Bratanov
Telerik team
 answered on 06 Feb 2012
1 answer
73 views
Hi,
I'm wondering if the license gives possibility of creation of CMS which uses the telerik controls?
What is the meaning of "design time" working with controls. If I create the CMS where on the web page users will be able to create their own websites and I design modules which are based on telerik controls does this mean that I do not respect the license? Or the "design time" working with controls mean that they are used in the IDE like Visual Studio?
Donna
Telerik team
 answered on 06 Feb 2012
5 answers
124 views
Hi Team,

We are trying to use Radcontrols for Asp.net Ajax inside SharePoint 2010.

I did followed the steps as mentioned in the http://www.telerik.com/help/aspnet-ajax/moss-incorporate-radcontrols-in-moss-sites.html

but its not working, i believe the link above is for sharepoint 2007,

Do the steps are same for sharepoint 2010 as well.

Please advise

Maria Ilieva
Telerik team
 answered on 06 Feb 2012
4 answers
182 views
Hi all,

I got a grid with some lines. I am using an edit column and handle the update command, but I can't find the modified row in the "e". I guess it is somewhere in the e.Item.DataItem, but I can't see it.

Anyone can help me?
Jocelyn
Top achievements
Rank 1
 answered on 06 Feb 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?