Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
66 views
Simple scenario: I want the edit form to appear above the column headers and I also want to hide the command item "row". I am not looking for a solution involving modals or placing the form outside of the radgrid.

Here's my code so far:

protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
    {
        RadGrid1.MasterTableView.IsItemInserted = true;
        RadGrid1.Rebind();
    }
 
    GridCommandItem commandItem = RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)[0] as GridCommandItem;
    commandItem.Visible = !RadGrid1.MasterTableView.IsItemInserted;
 
    if (!commandItem.Visible) // If edit form is open
    {
        GridEditFormItem editFormItem = RadGrid1.MasterTableView.GetItems(GridItemType.EditFormItem)[0] as GridEditFormItem;
 
        editFormItem.Parent.Controls.Remove(editFormItem);
        commandItem.Parent.Controls.AddAt(0, editFormItem);
    }
}

But during asynch postbacks all goes to hell: the edit form disappears.
Tsvetina
Telerik team
 answered on 20 Mar 2012
2 answers
251 views
We've implemented a custom server-side function which combines cropping and applying text to an image. Ultimately, our server side method saves a new version of the cropped image to the file system. We are attempting to re-render the saved, cropped image back into the ImageEditor. However, when the ImageEditor is updated after the server-side operation, the cropped image is skewed and seems to be stretched to the width and height of the original image.

I've observed that setting args.cancel = true in our server-side method causes the same behavior I've described above to occur.

What is the appropriate way to refresh/repaint the RadImageEditor after a server-side operation?

<asp:UpdatePanel ID="updtImagepanel" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <div style="height: 600px" id="designDiv" runat="server">
            <table>
                <tr>
                    <td>
                        <div style="height: 600px; width: 400px;">
                            <telerik:RadImageEditor ID="RadImageEditor" runat="server" StatusBarMode="Hidden"
                                Width="400px" Height="600px" OnImageEditing="Image1_ImageEditing" EnableResize="true">
                                <Tools>
                                    <telerik:ImageEditorToolGroup>
                                    </telerik:ImageEditorToolGroup>
                                </Tools>
                            </telerik:RadImageEditor>
                        </div>
                    </td>
    </ContentTemplate>
</asp:UpdatePanel>

Server-Side Code:

protected void Image1_ImageEditing(object sender, ImageEditorEditingEventArgs args){
            args.Cancel = true;
            string fileFolder = ConfigurationManager.AppSettings["Telerik_FileUpload"];
            string fileName = string.Empty;
 
            var commandArguments =
                (Dictionary<string, object>)args.ClientObjectsDictionary["commandArgument"];
 
            if (args.CommandName == "SaveImage")
            {
                EditableImage editableImage = args.Image;
                // Cropping Of an Image
                Rectangle cropRectangle = new Rectangle(
                    Convert.ToInt16(commandArguments["viewportX"]) - Convert.ToInt16(commandArguments["topX"]),
                    Convert.ToInt16(commandArguments["viewportY"]) - Convert.ToInt16(commandArguments["topY"]),
                    400,
                    600);
                     
                editableImage.Crop(cropRectangle);
 
                // Applying Title, Subtitle on Image
                //
                //Code to set variables for ApplyText method omitted for brevity
                //
                //Custom function to apply text to the cropped image
                Image newImage = ApplyText(titlePosition, subTitlePosition, authorNamePosition, title, subtitle, authorName, editableImage);
 
                newImage.Save(Path.Combine(fileFolder, fileName), ImageFormat.Jpeg);
 
                RadImageEditor.ImageUrl = //path to my image
 
                updtImagepanel.Update();
            }
        }

Dobromir
Telerik team
 answered on 20 Mar 2012
1 answer
75 views
I'm trying to handle AJAX calls differently in ASP.NET, depending on whether they are made by the end user or through my own code.

I'm using the Telerik RAD drop down and Telerik date picker control in my page.

Both have Client events that can be triggered and handled.

Are these client events only able to be triggered via user interaction?
Tsvetina
Telerik team
 answered on 20 Mar 2012
1 answer
96 views
I have developed a subscription based web application using ASP.NET (C#). Applicaiton is used to give user accounts to different customers to download some files from website. I want to measure the bandwidth used by each customer account during downloading.
I'm using SQL Server 2008 at the backend where the user account information as well as download history and total download size are maintained on it.
Infact I want to calculate the bandwidth used by each customer during any download file process. Each customer is assigned certain amount of bandwidth. I want to calculate this during the session of a customer, not at the website level. Something exactly like "sharing-hub.com" website.
Is there any of ASP.NET RadControls can be of help?
Any comments and suggestions are welcomed.
Simon
Telerik team
 answered on 20 Mar 2012
3 answers
308 views
Why does the following not open the webpage in a new window, as expected?

<telerik:RadButton ID="RadButton15" runat="server" 
    PostBackUrl="~/CostDashboard.aspx" Skin="Default" Target="_blank" 
    Text="Costing" Visible="True" Width="200px" ButtonType="LinkButton">
</telerik:RadButton>

David Penny
Slav
Telerik team
 answered on 20 Mar 2012
1 answer
161 views
I'm applying css classes to timeslots in the OnTimeSlotCreated event.  I'm also only using the timeline view, and my scheduler is in an ajax panel and a radsplitter.  When the scheduler initially loads, all the timeslots look blank (greyed out), but when I click the Timeline button on the top right, everything renders fine.  Also, I found out that if I override the timeslot css and specify position: relative that it renders fine the first time, but is layed out on top of appointments.  Here is my scheduler code and the code-behind that sets css classes.  Any help would be greatly appreciated.
<telerik:RadScheduler runat="server" ID="RadScheduler1" TimelineView-NumberOfSlots="7" AdvancedForm-Enabled="false"
    OnClientAppointmentClick="appointmentClick" EnableExactTimeRendering="false" SelectedView="TimelineView"
    CustomAttributeNames="SRID,PhaseID" OnAppointmentContextMenuItemClicked="RadScheduler1_AppointmentContextClick"
    DataStartField="StartDate" DataEndField="EndDate" DataKeyField="PhaseID" DataSubjectField="PhaseName"
    DataSourceID="PhasesDataSource" AllowDelete="false" AllowEdit="true" AllowInsert="false" 
    OnTimeSlotCreated="RadScheduler1_TimeSlotCreated" OverflowBehavior="Scroll" EnableAjaxSkinRendering="true"
    DayView-UserSelectable="false" WeekView-UserSelectable="false" MonthView-UserSelectable="false"
    GroupBy="PhaseName" GroupingDirection="Vertical" RowHeaderWidth="150px"  >
    <AppointmentTemplate>
        <b><%# Eval("SRID") %></b>
            
    </AppointmentTemplate>
    <AppointmentContextMenus>
        <telerik:RadSchedulerContextMenu runat="server" ID="SchedulerAppointmentContextMenu">
            <Items>
                <telerik:RadMenuItem Text="Unschedule" Value="CommandEdit" />
            </Items>
        </telerik:RadSchedulerContextMenu>
    </AppointmentContextMenus>
    <TimelineView GroupingDirection="Vertical" NumberOfSlots="7" GroupBy="PhaseName" />
    <ResourceHeaderTemplate>
        <asp:Panel runat="server" ID="resoursePanel">
            <asp:Label ID="Label1" runat="server" Text='<%# Eval("Text") %>'></asp:Label>
        </asp:Panel>
    </ResourceHeaderTemplate>
    <ResourceTypes>
        <telerik:ResourceType KeyField="PhaseName" Name="PhaseName" TextField="PhaseName" ForeignKeyField="PhaseName"
            DataSourceID="AllPhases" />
    </ResourceTypes>
</telerik:RadScheduler>
Random r = new Random();
protected void RadScheduler1_TimeSlotCreated(object sender, Telerik.Web.UI.TimeSlotCreatedEventArgs e)
{
    if (e.TimeSlot.Duration.Days == 1)
    {
        DateTime date = e.TimeSlot.Start;
        if (date.DayOfWeek != DayOfWeek.Saturday && date.DayOfWeek != DayOfWeek.Sunday)
        {
            int allocated = getAllocatedTime_Day(date,e.TimeSlot.Resource.Text);
            if (allocated <= 0)
                e.TimeSlot.CssClass += "timeslot-empty";
            else if (allocated < 25)
                e.TimeSlot.CssClass += "timeslot-low";
            else if (allocated < 45)
                e.TimeSlot.CssClass += "timeslot-mediumlow";
            else if (allocated < 65)
                e.TimeSlot.CssClass += "timeslot-medium";
            else if (allocated < 85)
                e.TimeSlot.CssClass += "timeslot-mediumhigh";
            else if (allocated <= 100)
                e.TimeSlot.CssClass += "timeslot-high";
            else if (allocated > 100)
                e.TimeSlot.CssClass += "timeslot-overbooked";
            else
                e.TimeSlot.CssClass += "timeslot-empty";
        }
    }
}
private int getAllocatedTime_Day(DateTime time,string department)
{
    return r.Next(0,120);
}
Ivana
Telerik team
 answered on 20 Mar 2012
1 answer
84 views
I need a little help.  I am having a problem opening a radwindow from a parent radwindow.  I have a radwindow that is called from a radgrid.
<CommandItemTemplate>
                               <table width="100%">
                           <tr class="customFont">
                         
                          <td align="left">
                           <asp:LinkButton ID="LinkButton2" runat="server" OnClientClick="openWin('/portals/0/NewSearch.aspx?AuthoringNames='); return false;"  >
                              <img style="border:0px;vertical-align:middle;" alt="" src="/portals/0/Images/add-icon.png" />New Search</asp:LinkButton>                              
                                 
                                    <asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="openWin2('/portals/0/NewPublicationList.aspx'); return false;"  >
                              <img style="border:0px;vertical-align:middle;" alt="" src="/portals/0/Images/add-icon.png" />Import PMID List</asp:LinkButton>                              
                                                          
                              
                              <td align="left">
                             </td>
                                                  
                          <td align="right">
                              <asp:LinkButton ID="LinkButton4" runat="server" OnClientClick="refreshGrid(); return false;" >
                              <img style="border:0px;vertical-align:middle;" alt="" src="/portals/0/Images/Refresh.png" /> Refresh</asp:LinkButton>
                                  
                          </td>
                      </tr>
         
           </table>
              </CommandItemTemplate>

The linkbutton calls


function openWin2(url) {
        var oWnd = $find("<%=RadWindow1.ClientID%>");
          var authorNames = document.getElementById('<%=HiddenField1.ClientID%>').value;
          oWnd.setUrl(url + "?AuthoringNames=" + authorNames);
       var oWnd = radopen("/portals/0/NewSearch.aspx?AuthoringNames=" + authorNames, "RadWindow1");
        }
The linkbuton needs two click to call the function.  If I change the function to oWnd.Show that it works on one click but I then can't get the parentwindow from the opened radwindow to open another window.  This line totally freezes in the opened window and will not call the second window
var oWnd2 = parentRadWindowManager.open("/portals/0/QuerySaver.aspx", "RadWindow3");

and this is my originating forms radWindow code

<telerik:RadWindowManager ID="RadWindowManager1" ShowContentDuringLoad="false" VisibleStatusbar="false" Modal="True"
     runat="server" EnableShadow="true">
     <Windows>
         <telerik:RadWindow ID="RadWindow1" runat="server"  Modal="true" Width="750" Height="600" OnClientClose="OnClientClose" Behaviors="Close,Move"
           ReloadOnShow="true" NavigateUrl="/portals/0/NewSearch.aspx" >
         </telerik:RadWindow>
            <telerik:RadWindow ID="RadWindow2" runat="server"  Modal="true" Width="750" Height="300" OnClientClose="OnClientClose" Behaviors="Close,Move"
           ReloadOnShow="true"  >
         </telerik:RadWindow>
         <telerik:RadWindow ID="RadWindow3"  runat="server" Width="650" Height="480" Modal="true"  NavigateUrl="/portals/0/QuerySaver.aspx" >
         </telerik:RadWindow>
         </Windows>
 </telerik:RadWindowManager>



Is this because I have my link button on a radGrid?
I've tried to totally follow your demos but none have it starting from a radgrid.

Thanks

Bill

Marin Bratanov
Telerik team
 answered on 20 Mar 2012
4 answers
1.3K+ views
I'm using your demo code from
http://demos.telerik.com/aspnet-ajax/window/examples/dialogreturnvalue/defaultvb.aspxand would like to put the button call that closes the window into code.
change this:

<div style="margin-top: 4px; text-align: right;">

 <button title="Submit" id="close" onclick="returnToParent(); return false;">

 Submit</button>

 </div>

into this:

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

      Button1.Attributes("onclick") = "return returnToParent(); return false;"

  End Sub

But it takes two clicks to call the function.  All help is apprecieted

rdmptn
Top achievements
Rank 1
 answered on 20 Mar 2012
1 answer
132 views
Hi Team,

I am using rad editor. i added the custom drop down using Tools.xml file and like to set the image instead of text as heading of drop down.
<tool name="InsertElement"  type="dropdown" showicon="true" showtext="false">
     <item name="xref" Value="xref"/>
     <item name="p" Value="p"/>
        </tool>
and add the back ground image using css
span.InsertElement
{
 background-image: url(../Images/icoElemCut.png);
 background-repeat :no-repeat;
 
}

using

.rade_toolbar

.InsertElement

also.
But i didnt get the image only. I got the drop down with image. I hace attached the image.

2. I need to assign the actual content to editor after editing some text in editor.

   first time, i bind the actual text to editor. It will display correct.
   then, i can edit some text and with out saving to data base, press the Reload button.
   While reloading, i will assign the actual content from data base to editor.
   It is assigned correctly in code behind. but editor shows with edited content. 
   How to refresh/update the editor while reassigning the content.

It is urgent project. Please help me.
Thanks in advance.
Uma 

 

 

 

Rumen
Telerik team
 answered on 20 Mar 2012
4 answers
349 views
I'm working with the Telerik RadWindow, and I am writing to ask how best to add a button to the RadWindow Title Bar;

Best regards - Rob
rdmptn
Top achievements
Rank 1
 answered on 20 Mar 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?