Telerik Forums
UI for ASP.NET AJAX Forum
10 answers
306 views
We're trying to use a RadWindow for printing some information entered by the user:

Here are the basic steps we're using in code behind:
  • New up a RadWindow

RadWindow window = new RadWindow();
window.ID = "windowShowPrintDialog";
//window.NavigateUrl = "PrintAdHoc.aspx";
window.VisibleOnPageLoad = true;
window.Modal = true;
window.Width = 200;
window.Height = 300;

  • Use LiteralControl to add info and JavaScript to window

string jsPrint = null;
using (StreamReader sr = new StreamReader(Server.MapPath("PrintWindowJavaScript.txt")))
{
    jsPrint = sr.ReadToEnd();
}
 
window.ContentContainer.Controls.Add(new LiteralControl(jsPrint));
 
...
 
 
 
window.ContentContainer.Controls.Add(new LiteralControl(name));
window.ContentContainer.Controls.Add(new LiteralControl(startdate));
window.ContentContainer.Controls.Add(new LiteralControl(enddate));
window.ContentContainer.Controls.Add(new LiteralControl("<button onclick=\"printWin(); return false\">print content</button><br />"));


  • PrintWindowJavaScript.txt is:

<script type="text/javascript">
function GetRadWindow()
{
    var oWindow = null;
    if (window.radWindow) oWindow = window.radWindow;
    else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
    return oWindow;
}
 
 
 function printWin()
            {
                var oWnd = GetRadWindow();
                var content = oWnd.GetContentFrame().contentWindow;
                var printDocument = content.document;
                if (document.all)
                {
                    printDocument.execCommand( "Print");
                }
                else
                {
                    content.print();
                }
 
            }  
 
</script>
  • Show window by adding it to the for controls

this.Form1.Controls.Add(window);


The RadWindow is displayed along with the print button.  When the print button is clicked, we get a java script error:

Microsoft JScript runtime error: Object required

at (see bold text):

function GetRadWindow()
{
    var oWindow = null;
    if (window.radWindow) oWindow = window.radWindow;
    else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
    return oWindow;
}

Is it possible to print and/or run javascript code from a RadWindow created like this?

Thanks,

Jerry



Marin Bratanov
Telerik team
 answered on 14 Sep 2011
4 answers
868 views
I have just downloaded the trial version of Rad Controls for ASP.NET AJAX. When I create a new rad control project in VS2010 I can add controls and they work properly. When I add rad controls to an exsisting project they no longer work. I have changed the web.config file of my exsisting project to match that of the rad control project that works, with the exception of the membership profile and connection strings for my databases. When I run the project that works with the date picker I get the calender image button that is supposed to be there, but when I run the project that doesn't work, instead of the button, I get text that says "Open the Pop Up Calender". Not sure if that info is helpful but may help with wny it isn't working. Any help on where to look to get things working is greatly appreciated.

Thanks
Maria Ilieva
Telerik team
 answered on 14 Sep 2011
1 answer
116 views
Dear Sirs,
we are using latest version of RadScheduler in our web application and we need to hide some custom attributes which are shown in the appointment's edit form such as the EndDate Date/Time pickers, subject textbox and so on.
In a previous version of tererik's library (maybe 2009) we used something like that on the FormCreated event:
RadDatePicker startDate = (RadDatePicker)e.Container.FindControl("StartDate");
RadDatePicker endDate = (RadDatePicker)e.Container.FindControl("EndDate");
endDate.CssClass = "Hide";
WebControl conEndTime = (WebControl)e.Container.FindControl("EndTime");
conEndTime.CssClass = "Hide";
RadTextBox subjectTextbox = (RadTextBox)e.Container.FindControl("Subject");
subjectTextbox.CssClass = "Hide";
RadTextBox tbxTicketId = (RadTextBox)e.Container.FindControl("AttrTicketId");
tbxTicketId.CssClass = "Hide";
tbxTicketId.LabelCssClass = "Hide";
................

but now it doesn't work anymore, so how can we hide the controls in the appointment form?
Many thanks in advance.
Best Regards.
Peter
Telerik team
 answered on 14 Sep 2011
0 answers
90 views
Hello,

I would like to insert/edit/update rows to the shipped orders grid. How could i make this?
 
Thank you very much.
George
Top achievements
Rank 1
 asked on 14 Sep 2011
1 answer
136 views
Have a strange one.

Using the telerik grid.  When we click on another page number the results refresh correctly.  But when we try to edit a item, the item that opens up is the item on page 1 in the same location.  Also if we click next page it always goes to page 2.
If we disable viewstate for the control it works fine also.  Also another weird thing is when the item opens a 404 file not found response(seen in fiddler) for a png file (called by webresource.axd) but the item opens fine even though its the wrong tiem.  The file is there and can be browsed directly in IIS.

The issue ony occurs on 2 load balanced servers. Testing done has been directly to one server bypassing the load balancer.  It works fine on other Windows 2008 R2 servers so don't think it's a issue with the code.
Is there any IIS configuration or applications that might cause this issue?  Any ideas?

Thanks!!
Radoslav
Telerik team
 answered on 14 Sep 2011
1 answer
69 views
I have a radeditor that is picking up the background image from the page that it's on.  In ie8, I created a stylesheet for the ContentAreaCssFile with the following properties

body {
            margin: 0 !important;
            padding: 0 !important;
            border: 0 !important;
            list-style: none !important;
            background-image: none !important;
            font:normal 13px Courier New !important;
            }

and that corrected the issue, but it doesn't seem to work in ie9.
Rumen
Telerik team
 answered on 14 Sep 2011
0 answers
124 views
Hi,

I am facing an issue with radComboBox with Telerik DLL Version (2011.1.413.35). Whenever I do a async callback to the Page ComboBox is getting disabled and am not able to change anything in Combobox.

Same is hapopening with my older version Telerik (2008.02.0826.35). We added a patch as provided by Telerik in previous thread but after patch adding also same issue is coming.
Patch Code snippet:--

<

 

 

script type="text/javascript">

 

 

 

 

 

//Uncomment this as well if you use RadAjaxPanel/RadAjaxManager to update any RadControl for ASP.NET AJAX.

 

 

 

// Telerik.Web.UI.RadAjaxControl.prototype._onFormSubmitCompleted = function (sender, args) {

// if (sender._xmlHttpRequest != null) {

// if (this._handleAsyncRedirect(sender._xmlHttpRequest)) {

// try {

// sender._aborted = true;

// }

// catch (e) {

// //

// }

// return;

// }

// }

 

 

// if (sender._xmlHttpRequest != null && !sender.get_timedOut()) {

// var scriptBlocks = this.getResponseItems(sender.get_responseData(), "scriptBlock");

// for (var i = 0, length = scriptBlocks.length; i < length; i++) {

// var content = scriptBlocks[i].content;

// if (content.indexOf(Sys.WebForms.PageRequestManager.getInstance()._uniqueIDToClientID(this._uniqueID)) != -1) {

// var linksString = content.substr(content.indexOf("\"links\":") + 10, content.indexOf("]", content.indexOf("\"links\":")) - (content.indexOf("\"links\":") + 10)).replace(/\"/g, '');

// if (linksString != "") {

// this._links = linksString.split(",");

// this.updateHeadLinks();

// }

// }

 

 

// if (content.indexOf(".axd") == -1 && scriptBlocks[i].id == "ScriptPath") {

// Telerik.Web.UI.RadAjaxControl.IncludeClientScript(content);

// }

// }

 

 

// var panels = this.getResponseItems(sender.get_responseData(), "updatePanel");

 

 

// Telerik.Web.UI.RadAjaxControl.panelsToClear = [];

 

 

// for (var i = 0, length = panels.length; i < length; i++) {

// var panel = panels[i];

// if (!$get(panel.id)) {

// var newUpdatePanel = document.createElement("div");

// newUpdatePanel.id = panel.id;

// var element = $get(panel.id.replace("Panel", ""));

 

 

// if (!element)

// continue;

 

 

// var parent = element.parentNode;

// var nextSibling = element.nextSibling || Telerik.Web.UI.RadAjaxControl.GetNodeNextSibling(element);

 

 

// if (element.nodeType === 1) {

// if (element.dispose && typeof (element.dispose) === "function") {

// element.dispose();

// }

// else if (element.control && typeof (element.control.dispose) === "function") {

// element.control.dispose();

// }

// var behaviors = Sys.UI.Behavior.getBehaviors(element);

// for (var j = behaviors.length - 1; j >= 0; j--) {

// behaviors[j].dispose();

// }

// }

 

 

// $telerik.disposeElement(element);

// parent.removeChild(element);

 

 

// Telerik.Web.UI.RadAjaxControl.InsertAtLocation(newUpdatePanel, parent, nextSibling);

// Telerik.Web.UI.RadAjaxControl.panelsToClear[Telerik.Web.UI.RadAjaxControl.panelsToClear.length] = panel;

// }

// }

// }

 

 

// sender.get_webRequest().remove_completed(this._onFormSubmitCompletedHandler);

// };

 

 

$telerik.disposeElement =

 

function (element) {

 

 

 

if (typeof (Sys.WebForms) == "undefined")

 

 

 

return;

 

 

 

 

 

var prm = Sys.WebForms.PageRequestManager.getInstance();

 

 

 

if (prm && prm._destroyTree)

 

prm._destroyTree(element);

 

 

else if (Sys.Application.disposeElement)

 

Sys.Application.disposeElement(element,

 

true);

 

};

 

 

Telerik.Web.UI.RadComboBox.prototype._removeDropDown =

 

function () {

 

 

 

var slide = this.get_dropDownElement().parentNode;

 

slide.parentNode.removeChild(slide);

 

 

 

 

if (this._disposeChildElements)

 

$telerik.disposeElement(slide);

 

 

 

 

if (!$telerik.isSafari)

 

slide.outerHTML =

 

null;

 

 

 

this._dropDownElement = null;

 

};

 

 

</script>

 



We are using RadAjaxPanel to update the Controls.
Please provide any solution to this issue, any help will be highly appreciated.

Thanks Vishal
Vishal
Top achievements
Rank 1
 asked on 14 Sep 2011
3 answers
785 views
Hi,
         I am binding Entity DataSource to RadGrid. Now the problem is when adding a new record, it throws "Specified cast is not available" Exception. it works fine for edit operation. I tried checking for null in getter of the property but the problem remains there. I am not able to figure out the problem.

                        <telerik:RadGrid ID="radProjectGrid" runat="server" AutoGenerateColumns="false" DataSourceID="entProjectDataSource" 
                            AllowAutomaticDeletes="true" AllowAutomaticInserts="true" AllowAutomaticUpdates="true" 
                            Skin="Default" OnItemCommand="radProjectGrid_ItemCommand"  
                            onitemcreated="radProjectGrid_ItemCreated"
                            <MasterTableView CommandItemDisplay="Top" AutoGenerateColumns="False" DataKeyNames="Project_ID" 
                                DataSourceID="entProjectDataSource"
                                <RowIndicatorColumn> 
                                    <HeaderStyle Width="20px" /> 
                                </RowIndicatorColumn> 
                                <ExpandCollapseColumn> 
                                    <HeaderStyle Width="20px" /> 
                                </ExpandCollapseColumn> 
                                <Columns> 
                                    <telerik:GridEditCommandColumn> 
                                    </telerik:GridEditCommandColumn> 
                                    <telerik:GridBoundColumn UniqueName="Project_Title" HeaderText="Project Title" DataField="Project_Title" 
                                        SortExpression="Project_Title"
                                        <HeaderStyle Width="150px" HorizontalAlign="Left" VerticalAlign="Middle" Wrap="true" /> 
                                        <ItemStyle Width="150px" HorizontalAlign="Left" VerticalAlign="Middle" Wrap="true" /> 
                                    </telerik:GridBoundColumn> 
                                    <telerik:GridBoundColumn DataField="ProjectLeader_Name" HeaderText="ProjectLeader Name" 
                                        SortExpression="ProjectLeader_Name" UniqueName="ProjectLeader_Name"
                                        <HeaderStyle Width="120px" HorizontalAlign="Left" VerticalAlign="Middle" Wrap="true" /> 
                                        <ItemStyle Width="120px" HorizontalAlign="Left" VerticalAlign="Middle" Wrap="true" /> 
                                    </telerik:GridBoundColumn> 
                                    <telerik:GridBoundColumn UniqueName="Location" HeaderText="Location" DataField="Location" 
                                        SortExpression="Location"
                                        <HeaderStyle Width="80px" HorizontalAlign="Left" VerticalAlign="Middle" Wrap="true" /> 
                                        <ItemStyle Width="80px" HorizontalAlign="Left" VerticalAlign="Middle" Wrap="true" /> 
                                    </telerik:GridBoundColumn> 
                                    <telerik:GridBoundColumn UniqueName="Start_Date" HeaderText="Start Date" DataField="Start_Date" 
                                        DataType="System.DateTime" SortExpression="Start_Date" DataFormatString="{0:MM/dd/yyyy}"
                                        <HeaderStyle Width="80px" HorizontalAlign="Left" VerticalAlign="Middle" Wrap="true" /> 
                                        <ItemStyle Width="80px" HorizontalAlign="Left" VerticalAlign="Middle" Wrap="true" /> 
                                    </telerik:GridBoundColumn> 
                                    <telerik:GridBoundColumn DataField="End_Date" DataType="System.DateTime" HeaderText="End Date" 
                                        SortExpression="End_Date" UniqueName="End_Date" DataFormatString="{0:MM/dd/yyyy}"
                                        <HeaderStyle Width="80px" HorizontalAlign="Left" VerticalAlign="Middle" Wrap="true" /> 
                                        <ItemStyle Width="80px" HorizontalAlign="Left" VerticalAlign="Middle" Wrap="true" /> 
                                    </telerik:GridBoundColumn> 
                                    <telerik:GridCheckBoxColumn DataField="IsVisible" DataType="System.Boolean" HeaderText="ShowOnWebsite" 
                                        SortExpression="IsVisible" UniqueName="IsVisible"
                                        <HeaderStyle Width="60px" HorizontalAlign="Left" VerticalAlign="Middle" Wrap="true" /> 
                                        <ItemStyle Width="50px" HorizontalAlign="Left" VerticalAlign="Middle" Wrap="true" /> 
                                    </telerik:GridCheckBoxColumn> 
                                    <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="column"
                                    </telerik:GridButtonColumn> 
                                </Columns> 
                                <EditFormSettings EditFormType="Template"
                                    <EditColumn UniqueName="EditCommandColumn1"
                                    </EditColumn> 
                                    <FormTemplate> 
                                        <div style="float: left"
                                            <table> 
                                                <tr> 
                                                    <td class="tdLeftAdmin"
                                                        Project Title: 
                                                    </td> 
                                                    <td class="tdRightAdmin"
                                                        <asp:TextBox ID="txtProjectTitle" runat="server" Text='<%# Bind("Project_Title") %>'></asp:TextBox> 
                                                    </td> 
                                                </tr> 
                                                <tr> 
                                                    <td class="tdLeftAdmin"
                                                        Location: 
                                                    </td> 
                                                    <td class="tdRightAdmin"
                                                        <asp:TextBox ID="txtLocation" runat="server" Text='<%# Bind("Location") %>'></asp:TextBox> 
                                                    </td> 
                                                </tr> 
                                                <tr> 
                                                    <td class="tdLeftAdmin"
                                                        Project Leader Name: 
                                                    </td> 
                                                    <td class="tdRightAdmin"
                                                        <asp:TextBox ID="txtProjectLeader" runat="server" Text='<%# Bind("ProjectLeader_Name") %>'></asp:TextBox> 
                                                    </td> 
                                                </tr> 
                                                <tr> 
                                                    <td class="tdLeftAdmin"
                                                        Start Date: 
                                                    </td> 
                                                    <td class="tdRightAdmin"
                                                        <telerik:RadDatePicker ID="rdpStartDate" runat="server" AutoPostBack="false" MinDate="01/01/1000" 
                                                            MaxDate="01/01/3000" DbSelectedDate='<%# Bind("Start_Date", "{0:D}") %>' /> 
                                                    </td> 
                                                </tr> 
                                                <tr> 
                                                    <td class="tdLeftAdmin"
                                                        End Date: 
                                                    </td> 
                                                    <td class="tdRightAdmin"
                                                        <telerik:RadDatePicker ID="rdpEndDate" runat="server" AutoPostBack="false" MinDate="01/01/1000" 
                                                            MaxDate="01/01/3000" DbSelectedDate='<%# Bind("End_Date","{0:D}") %>' /> 
                                                    </td> 
                                                </tr> 
                                                <tr> 
                                                    <td class="tdLeftAdmin"
                                                        Website: 
                                                    </td> 
                                                    <td class="tdRightAdmin"
                                                        <asp:TextBox ID="txtWebsite" runat="server"></asp:TextBox> 
                                                    </td> 
                                                </tr> 
                                                <tr> 
                                                    <td class="tdLeftAdmin"
                                                        ShowOnWebsite 
                                                    </td> 
                                                    <td class="tdRightAdmin"
                                                        <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("IsVisible") %>'/> 
                                                    </td> 
                                                </tr> 
                                                <tr> 
                                                    <td class="tdLeftAdmin"
                                                        <asp:Button ID="btnUpdate" runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' 
                                                            Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' /> 
                                                    </td> 
                                                    <td class="tdRightAdmin"
                                                        <asp:Button ID="btnCancel" runat="server" CausesValidation="False" CommandName="Cancel" 
                                                            Text="Cancel" /> 
                                                    </td> 
                                                </tr> 
                                            </table> 
                                        </div> 
                                        <div style="width: 450px; float: right;"
                                            <table> 
                                                <tr> 
                                                    <td class="tdLeftAdmin"
                                                        Goal: 
                                                    </td> 
                                                    <td class="tdRightAdmin"
                                                        <asp:TextBox ID="txtGoal" runat="server" Text='<%# Bind("Goal") %>' TextMode="MultiLine"></asp:TextBox> 
                                                    </td> 
                                                </tr> 
                                                <tr> 
                                                    <td class="tdLeftAdmin"
                                                        Objective: 
                                                    </td> 
                                                    <td class="tdRightAdmin"
                                                        <asp:TextBox ID="txtObjective" runat="server" Text='<%# Bind("Objective") %>' TextMode="MultiLine"></asp:TextBox> 
                                                    </td> 
                                                </tr> 
                                                <tr> 
                                                    <td class="tdLeftAdmin"
                                                        Project Image: 
                                                    </td> 
                                                    <td class="tdRightAdmin"
                                                        <telerik:RadUpload ID="radUploadProjectImage" runat="server" ControlObjectsVisibility="None" 
                                                            TargetFolder="~/Images"
                                                        </telerik:RadUpload> 
                                                    </td> 
                                                </tr> 
                                                <tr> 
                                                    <td class="tdLeftAdmin"
                                                        Leader Image: 
                                                    </td> 
                                                    <td class="tdRightAdmin"
                                                        <telerik:RadUpload ID="radUploadProjectLeaderImage" runat="server" ControlObjectsVisibility="None" 
                                                            TargetFolder="~/Images"
                                                        </telerik:RadUpload> 
                                                    </td> 
                                                </tr> 
                                            </table> 
                                        </div> 
                                    </FormTemplate> 
                                </EditFormSettings> 
                            </MasterTableView> 
                            <ClientSettings> 
                                <ClientEvents OnRowDblClick="RowDblClick" /> 
                            </ClientSettings> 
                        </telerik:RadGrid> 


Ragards,
Thank  you in advance,
Pavlina
Telerik team
 answered on 14 Sep 2011
1 answer
197 views

I am using RadScheduler, but I have a little bit unusual requirements. Couple things I need to do:

  1. Depending on a resource associated with Appointment and a role of a current user, certain appointments should not be editable. So, I need to disable a pop-up when appointment is double-clicked in Scheduler, any suggestion how to do it.
  2. Is there any way to hide “recurring event” check box on the appointment edit pop-up? We do not need that at all so it is OK to hide it for good.

Thank you 

Nikolay Tsenkov
Telerik team
 answered on 14 Sep 2011
3 answers
146 views
Hi all,
I'm having a problem with paging in an Ajax RadGrid.
When NeedDataSource is fired, I am dynamicallly retrieving data depending on a list type (that I'm passing through to page).
As an example, if I need to show a list of sizes, I call the following:
1. dv (dataview) = getSizes()
2. getSizes() runs the following code:

Dim dbConn As String = [get conn string]
            Dim query As String = ""
            Dim selectClause As String = "SELECT ID, AccountType "
            Dim fromClause As String = "FROM tbl_WIP_DATA_AccountTypes WITH (NOLOCK) "
            Dim whereClause As String = "WHERE Active=1 AND Deleted=0"
            If FilterExpression <> "" Then FilterExpression = " AND AccountType LIKE '%" & CleanForSQL(FilterExpression) & "%'"
            whereClause &= " " & filterExpression
            query = selectClause & " " & fromClause & " " & whereClause & " ORDER BY AccountType ASC"
            Return WIP.Data.SqlHelper.ExecuteDataset(dbConn, CommandType.Text, query).Tables(0).DefaultView


Now this works fine!  Paging etc works as it should.  As you can see, it's dynamic t-sql.
BUT, if the getSizes() functions calls a second function get build a generic sql statement (based on a metadata system),
Radgrid displays the records correctly, but refuses to page.
I've tested the resulting queries and they are identical.

Does anyone have any suggestions why this would not work?!

Cheers in advance,
Rich

 


Radoslav
Telerik team
 answered on 14 Sep 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
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?