Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
263 views

Hello,

 I have a question I hope someone has an answer for.

 

I have a custom control that includes  the RadAsyncUpload control.  In the onInit event handler calculate a MaxFileSize based on a config file setting and then register a couple of scripts to handle the error display if the file being uploaded exceeds the MaxFileSize:

 i.e

             StringBuilder sb = new StringBuilder();

             sb.Append("\n\t<script type=\"text/javascript\">\n\t\tfunction UploadValidationError(sender, eventArgs)\n\t\t{\n\t\t\talert('")

              .Append(AlertText1)
              .Append(": ' + eventArgs.get_fileName() + ' ")
              .Append(AlertText2).Append(" ")
              .Append(MaxFileSize.ToString())
              .Append(" kb.\');\n\t\t}\n\t</script>");

             Page.Header.Controls.Add(new LiteralControl(sb.ToString()));               

 

            StringBuilder sb2 = new StringBuilder();

             sb2.Append("\n\t<script type=\"text/javascript\">\n\t\tfunction FileUploadError(sender, eventArgs)\n\t\t{\n\t\t\talert('")
               .Append(AlertText3)
               .Append(" ' +  eventArgs.get_message() );\n\t\t}\n\t</script>");

              Page.Header.Controls.Add(new LiteralControl(sb2.ToString()));

 Then when the RadAsyncUpload control is being added to the

            public Telerik.Web.UI.RadAsyncUpload _uploadControl = new Telerik.Web.UI.RadAsyncUpload();

  

                this._uploadControl.ID = "u" + this.QuestionID;

                this._uploadControl.InitialFileInputsCount = 1;
                this._uploadControl.MaxFileInputsCount = 1;
                this._uploadControl.MaxFileSize = MaxFileSize;
                this._uploadControl.FileUploaded += new FileUploadedEventHandler(File_FileUploaded);
                this._uploadControl.TemporaryFolder = _fileVirtualPath;
                this._uploadControl.TargetFolder =_fileVirtualPath ;
                this._uploadControl.HttpHandlerUrl = "~/RadUpload/RadUploadFile.ashx";
                this._uploadControl.Width = new Unit(250);
                this._uploadControl.CssClass = "normalRemoveButton";
                this._uploadControl.OnClientValidationFailed = "UploadValidationError";
                this._uploadControl.OnClientFileUploadFailed = "FileUploadError"; 
                this._uploadControl.Style.Add("display", "block");   
                this._uploadLabel.Text = NoFileSelectedText;
                this._uploadLabel.Enabled = false;
                this._uploadControl.Culture = new System.Globalization.CultureInfo(CultureCode);

This all works flawlessly on most browsers, select a file too large and the alert box pops up indicating that the filesize exceeds the limit.  However on some testers machines, when they select a file to upload that is way too large , the yellow uploading line activates, the alert box does not show, and it continues in that state for several minutes if you let it.

 

 (I am not even sure that it is browser related, it may be individual machines and the browser configutration).  It does not seem to be version specific, we have tried this under IE7, IE8, and IE9.

 
Any ideas?

 
Thanks,
Gary

 

Peter Filipov
Telerik team
 answered on 13 Jul 2011
3 answers
82 views
I have a hierarchical grid with just a master table and a detail table.  I am allowing autocolumn creation when the datasource is bound.  As the columns are created I need to selectively hide and format some of them.  I do this in the ColumnCreated procedure using a GridBoundColumn variable to reference each column in turn.  The problem is that I can't find a way to identify whether a column is in the master table or the detail table to determine what to do with it.  If all column names were unique this wouldn't be an issue but some of them aren't and they need to be seen on either the master record or the detail record, but not both.

Thanks for any help you can give me.
Mira
Telerik team
 answered on 13 Jul 2011
1 answer
315 views
Hello,

I have a database where the user may upload an alternative image for a device.
If the image is not present in the database, the datasource returns a DBNull and the binary image should show the standard image file from the servers image directory.
I used this code which works fine if the image is not present.

<telerik:RadBinaryImage ID="RadBinaryImage1" runat="server"
   DataValue='<%# Eval("Data") is DBNull ? null : Eval("Data")%> '
  
AlternateText=" " AutoAdjustImageControlSize="true" 
   ImageUrl='<%# Eval("Type", "~/Images/Devices/{0}_sml.png") %>'
  
Width="64px" Height="64px" ImageAlign="Middle" ResizeMode="Fit" />

If the database returns the image I get this error message during the page creation:
"Cannot set image Url if DataValue is already set"

If I remove the ImageUrl property, the image of the database is shown properly. So it's surely not a corrupted image file.
I am currently using the following workaround:
<telerik:RadBinaryImage ID="DeviceBinaryImage" runat="server"
    DataValue='<%# Eval("Data") is DBNull ? null : Eval("Data")%> '
   
AlternateText=" " AutoAdjustImageControlSize="true"
    Visible='<%# Eval("Data") is DBNull ? false : true %>'
   
Width="64px" Height="64px" ImageAlign="Middle" ResizeMode="Fit" />
 <asp:Image ID="Image1" runat="server" 
        ImageUrl='<%# Eval("Type", "~/Images/Devices/{0}_sml.png") %>' 
    Visible='<%# Eval("Data") is DBNull ? true : false %>' />

Is it possible to set DataValue and the alternative ImageUrl Property of a single RadBinaryImage?
I would expect the RadBinaryImage to ignore the ImageUrl if DataValue has data.


UPDATE
Forget about the thread.
Simply swapping the order of ImageUrl and DataValue did the trick. :)



Mira
Telerik team
 answered on 13 Jul 2011
7 answers
88 views
Hello,

I have a problem in Internet Explorer when I add a ribbonbar in RadSlidingZone as you can see on the attached file. With Firefox or Chrome, it works well.

I used the same ribbonbar like in your website
http://demos.telerik.com/aspnet-ajax/ribbonbar/examples/default/defaultcs.aspx

There are three tabs defined in the ribbonbar.

Have you any idea about this?

Thank you,

André
Simon
Telerik team
 answered on 13 Jul 2011
3 answers
115 views
Hi,

 Consider my browser window  is less than screen size and I want to move Radwindow outside current browser area any where in the screen.Is it possible to drag Radwindow outside browser window?

Thanks,
Prava
Prava kafle
Top achievements
Rank 1
 answered on 13 Jul 2011
3 answers
167 views
Hi all,

I am looking to achieve the following functionality: All events whose effects are self-contained to a RadDock should only cause post-back for that specific RadDock.

That being said, it is (slightly!) more complicated than this. All my RadDocks and RadDockZones on my page are dynamically created and regenerated.

I have reviewed the information given here, but I did not find this documentation enough to successfully achieve my goal. As such, I have a few questions.

  • I understand that there is an inherited complexity to this issue in the fact that RadDocks are able to be moved between RadDockZones. This appears to disqualify making the RadDock the designated 'control initiating post-back.' If I attempt to say "RadAjaxManager1.AjaxSettings.Add(dock, dock, null)" I am told that RadDockZone must have RadDock as child (and not this hidden update panel). As such, it is my belief that I will be achieving my desired results through wrapping of the RadDockZone in a hidden update panel, and not each individual RadDock.
  • That being said, my project does have constraints which may be useful/relevant to this issue -- Each RadDockZone has a 0 to 1 relationship with a RadDock. That is, RadDockZones with greater than 1 RadDock is not a supported scenario for my project. In addition, each RadPane on my page will have no more than 1 RadDockZone on it. Keeping things very simple 1:1:1 display.
  • In addition, each of my RadDocks is currently housing an UpdatePanel. This is used to update the contents of the dock instantly (charts that drill-down.) I know that UpdatePanels may sometimes cause conflicts, so I thought this was worth mentioning.
  • The RadAjaxManager documentation states that adding AJAX pairs dynamically to the RadAjaxManager should only be performed during Page_Load. I am curious if I need to perform initial "hook-up" of the setting when the control is dynamically created and then regenerate this state similarly to how all the other states on my page are regenerated. An example:

protected void LstBxSettings_Dropped(object sender, RadListBoxDroppedEventArgs e)
{
    RadDockZone dockZone = DashboardLayoutManager.Instance.RegisteredDockZones.FirstOrDefault(registeredDockZone => e.HtmlElementID.Contains(registeredDockZone.ID));
 
    if (!object.Equals(dockZone, null) && !dockZone.Docks.Any())
    {
        RadPane activeControlPane = (RadPane)dockZone.Parent;
        Orientation orientation = (Orientation)Enum.Parse(typeof(Orientation), e.SourceDragItems[0].Value);
        CormantRadSplitter newContent = CreationManager.CreateNewContent(orientation, activeControlPane);
        //Put newly created control in front so it will always be visible. (E.G. RadDockZone1 fights with it)
        activeControlPane.Controls.AddAt(0, newContent);
        RadControlManager.SaveNewContent(newContent);
        lstBxSettings.ClearSelection();
    }
}

This is a piece of code which is responsible for creating a new RadDock on my page, as well as attaching it to a RadDockZone. Note that RadDockLayout is not used (I've implemented my own). I am wondering if I need to say "RadAjaxManager1.AjaxSettings.AddAjaxSetting(dockZone, dock, null)" here during creation of this control. My gut is saying, "Yes. You do" because the controls are rendered to the user immediately after creation. If I only hook up settings during Page_Load then the control will be displayed to the user once, then a post back occurs, page_load fires, and now the control is wrapped in an update panel. As such, it is my belief that it is necessary to add it to AjaxManager immediately. Please correct me if I am wrong here.

Now, lets talk about what needs to occur every time a page load occurs. RadAjaxManager is a persistent control on my page. So, it is my belief that it does not forget the AjaxSettings it knew from before a post-back occurs, but that it probably does forget after a full page refresh. As such, it is my belief that I do need to re-setup settings during each page load, but that I should be looking into my AjaxSettings collection to see if a setting is known already. If the RadDockZone (the control to initiate an ajax request) is unknown, then I add it to the collection, else skip since it's already known.

protected void Page_Load(object sender, EventArgs e)
{
    Logger.Info("Page Load");
    RegenerationManager.Instance.RegenerateDockContents();
 
    if (!Page.IsPostBack)
    {
        RegenerationManager.Instance.RegenerateTabs(RadTabStrip1);
        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "KEY01", "ForceResize();", true);
    }
}

Here is my current Page_Load event. Should I be treating the AjaxManager similarly to that of the RadTabStrip -- only hooking up controls if its a fresh page, else assuming that they're already known to it (being added through the event described above)?

I went ahead and played with all of this myself for a bit, but I noticed I was doing something incorrect. What I saw was that the RadDock would fire a post-back event, the hidden update panel would capture the event, but that the RadDock would not update. Interacting with the page again caused it to update, but the update panel I had wrapped was lost (haven't fussed with regenerating it through post-back, so this is expected behavior.) Might be a deeper-seated issue than just improper setting up of the code, though, so I figured I'd come here first.

Is my reasoning sound? What other gotchas should I be aware of? 

Thanks.

Sean
 
Slav
Telerik team
 answered on 13 Jul 2011
1 answer
60 views
I'm using the scheduler fed by a web service and come across a date in the wrong format. The tooltip on the date within the day of a month view is in american format. How can I change this so it picks up the current culture?

I've tried changing Monthviewdayheader and setting the culture in web.config. Not sure what else to try.

Thanks
Plamen
Telerik team
 answered on 13 Jul 2011
1 answer
152 views
Hi Telerik Team,

   I am Arvind i am working on Rad window and new to work on it, I have designed a Content Page and it consists of a tree view based on node that user clicks a rad window will be opened (for this i have designed a user control and this user control i have kept inside a Aspx page (Not a Content Page) ) and the rad window consists of a drop down when user will select a value from the Drop Down and Clicks on the Button the i am able to get the selected value from the Drop down and when i try to get that value in the Content Page i am not able to get it, Actually the Content page that i have created has a Rad Editor, in the rad Windows user will choose his choice and that should be inserted in to rad Editor.

Please Help me, its very Urgent

Thanks & Regards

N Aravinda
Marin Bratanov
Telerik team
 answered on 13 Jul 2011
3 answers
162 views

I have some issue putting a datapager to a list box. When i run my aspx page, it doesnt show any paging
 Following below is my code
<telerik:RadDataPager ID="RadDataPager1" runat="server" PagedControlID="RadListBox1">
 </telerik:RadDataPager>
 
  <telerik:RadListBox ID="RadListBox1" runat="server" AutoPostBack="True"
                                                DataKeyField="EventLocation" DataSourceID="Listbox"
                                                DataTextField="EventLocation" DataValueField="EventLocation"
                                                DlisataKeyField="EventLocation" Skin="Black" allowpaging="true"
                                                style="z-index: 1; left: 1109px; top: 114px; position: absolute; height: 48px; width: 155px; text-align: center;"> <ButtonSettings TransferButtons="All" />
    </telerik:RadListBox>

Peter Filipov
Telerik team
 answered on 13 Jul 2011
3 answers
347 views
Hi,

I want to force my users to input data in a specific format. The format is digit-digit-capital letter-digit-digit-digit e.g. 30H120.

So if the user types a letter instead of a digit for the 2nd character, the control must simply reject the input. And if possible, when the user enters a small letter for the 3rd character, it must be auto capitalized.

Any ideas?

Thanks,
Christo
Christo
Top achievements
Rank 1
 answered on 13 Jul 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?