Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
144 views
I am trying to set the WorkDayStartTime and WorkDayEndTime properties when the page first loads with values stored in my web.config.  I have tried to set in bot the page onInit and onLoad events to set these values, but they effect of setting the values doesn't show when the page initally loads, but it will display properly after a postback.  Is there some way to get these settings to take affect when the page first loads.  The setting of DayStartTime and DayEndTime work correctly.
Ivana
Telerik team
 answered on 13 Jul 2012
0 answers
68 views
Is there any way to export radgrid in image (jpg, bmp etc), instead of pdf, excel, csv etc?
Munish
Top achievements
Rank 1
 asked on 13 Jul 2012
0 answers
179 views
I am using below code to avoid prompting for filename/path, while exporting telerik grid. In this if I remove last line response.redirect then it again started asking for filename/path. Can you please suggest any other way, because i dont to perform response.redirect after this action?


protected void RadGridData_GridExporting(object source, GridExportingArgs e)
        {
            string gridfile = "c:\\grid.pdf";
            files.Add(gridfile);
            using (FileStream fs = File.Create(gridfile))
            {
                Byte[] info = System.Text.Encoding.Default.GetBytes(e.ExportOutput);
                fs.Write(info, 0, info.Length);
            }
            Response.Redirect(Request.Url.ToString());
        }
Munish
Top achievements
Rank 1
 asked on 13 Jul 2012
1 answer
170 views
I'm having some problem getting a repeater with a nested repeater update with ajaxmanger.

Se example page here: http://dev12.spireweb.no/repeater_ajax.aspx 

I just want the nested repeater in the post to update when a comment this added or deleted. This only works for the first post.
Is there a way to solved this issue?

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="btnRefreshPosts" EventName="onclick">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="pnlPosts" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="repPosts" EventName="onitemcommand">
                    <UpdatedControls>                   
                        <telerik:AjaxUpdatedControl ControlID="pnlComments" />                 
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="repComments" EventName="onitemcommand">
                    <UpdatedControls>                   
                        <telerik:AjaxUpdatedControl ControlID="pnlComments" />                 
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>


<asp:Panel ID="pnlPosts" runat="server">
                   <div id="Posts" style="padding:10px;margin:15px; width:700px;">
                       <asp:Repeater ID="repPosts" runat="server" onitemdatabound="repPosts_ItemDataBound" OnItemCommand="repPosts_ItemCommand">
                           <ItemTemplate>
                               <div class="postitem" >
                                   <div class="sep"></div>
                                   <div class="postitem_name" >
                                       <asp:Literal ID="litName" runat="server" />
                                       <asp:Literal ID="litCreated" runat="server" />                                   
                                   </div>
                                   <div class="postitem_content">
                                       <asp:Button ID="btnDelete" runat="server" Text="" CssClass="btnDelete" />
                                       <asp:Literal ID="litContent" runat="server" />
                                   </div>                                   
                               </div>
                               <div style="clear:both;"></div>
                                   <asp:Panel ID="pnlComments" runat="server">
                                   <div class="CommentsWrapper">
                                       <asp:Repeater ID="repComments" runat="server" OnItemDataBound="repComments_ItemDataBound" OnItemCommand="repComments_ItemCommand">
                                           <HeaderTemplate>
                                                   <h3>Comments</h3>
                                           </HeaderTemplate>
                                           <ItemTemplate>
                                                   <div class="Comment">       
                                                       <asp:Button ID="btnDelete" runat="server" Text="" CssClass="btnDelete" />                                       
                                                       <asp:Literal ID="litComment" runat="server" />                                               
                                                   </div>
                                           </ItemTemplate>
                                       </asp:Repeater>
                                       <div class="AddComment">
                                           <asp:Panel ID="pnlAddComment" runat="server" DefaultButton="btnAddComment">
                                               <asp:TextBox ID="txtComment" runat="server"></asp:TextBox>
                                               <asp:Button ID="btnAddComment" CssClass="common btnAddComment" runat="server" Text="Submit" />
                                           </asp:Panel>
                                       </div>
                                       <div style="clear:both;"></div>
                                   </div>
                               </asp:Panel>
                           </ItemTemplate>                   
                       </asp:Repeater>
                   </div>
               </asp:Panel>


protected void GetPosts()
    {
        repPosts.DataSource = WineclubManager.GetPosts(19,20);
        repPosts.DataBind();
    }
    protected void repPosts_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
        {
            PostItem row = (PostItem)(e.Item.DataItem);
            CustomerItem customer = CustomerManager.GetCustomer(row.CustomerID);
            Repeater repComments = (Repeater)e.Item.FindControl("repComments");
 
            Literal litName = (Literal)e.Item.FindControl("litName");
            Literal litCreated = (Literal)e.Item.FindControl("litCreated");
            Literal litContent = (Literal)e.Item.FindControl("litContent");
            TextBox txtComment = (TextBox)e.Item.FindControl("txtComment");
 
            Button btnAddComment = (Button)e.Item.FindControl("btnAddComment");
            Button btnDelete = (Button)e.Item.FindControl("btnDelete");
 
            if (row.CustomerID != 0)
                litName.Text = "<span>" + customer.Firstname + " " + customer.Lastname + "</span>";
            else
                litName.Text = "<span>LabelWines</span>";
 
            litCreated.Text = "<span class=\"date\">" + row.Created.ToString("dd.MM.yyyy HH:mm") + "</span>";
            litContent.Text = row.Content;
 
            txtComment.Text = "Write a comment";
 
            if (row.CustomerID == CustomerManager.GetCustomerID())
            {
                btnDelete.CommandName = "Delete";
                btnDelete.CommandArgument = row.ID.ToString();
                btnDelete.Attributes.Add("onclick", "jConfirm('" + Resources.Language.Wineclub_PostPopupMessage.Replace(Environment.NewLine, "<br />") + "', '" + Resources.Language.Wineclub_PostPopupHeader + "', function(r) { if(r==true) __doPostBack(\"" + btnDelete.ClientID.Replace("_", "$") + "\", \"\"); }); return false;");
            }
            else
                btnDelete.Visible = false;
 
            btnAddComment.CommandName = "AddComment";
            btnAddComment.CommandArgument = row.ID.ToString();
            BindInnerRepeaterComments(repComments, row.ID);
        }
    }
    protected void repPosts_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        switch (e.CommandName)
        {
            case "AddComment":
                CommentItem item = new CommentItem();
                item.PostID = int.Parse(e.CommandArgument.ToString());
                item.CustomerID = 2;
 
                TextBox txtComment = e.Item.FindControl("txtComment") as TextBox;
                if ((txtComment.Text.Length > 0) && (txtComment.Text != "Write a comment"))
                    item.Comment = txtComment.Text;
                int id = WineclubManager.AddComment(item);
 
                txtComment.Text = Resources.Language.Wineclub_PostDefaultCommentText;
                Repeater repComments = (Repeater)e.Item.FindControl("repComments");
                BindInnerRepeaterComments(repComments, int.Parse(e.CommandArgument.ToString()));
 
                RadAjaxManager ra = (RadAjaxManager)(Page.FindControl("RadAjaxManager1"));
                ra.ResponseScripts.Add("javascript:InitCommentTextFields();");
                 
                break;
        }
        switch (e.CommandName)
        {
            case "Delete":
                WineclubManager.DeletePost(int.Parse(e.CommandArgument.ToString()));
                GetPosts();
 
                RadAjaxManager ra = (RadAjaxManager)(Page.FindControl("RadAjaxManager1"));
                ra.ResponseScripts.Add("javascript:InitCommentTextFields();");
                ra.ResponseScripts.Add("javascript:YoutubePosts();");
                break;
        }
    }
    private void BindInnerRepeaterComments(Repeater Rep, int PostID)
    {
        CommentCollection items = WineclubManager.GetComments(PostID, false);
        if (items.Count > 0)
        {
            Rep.DataSource = items;
            Rep.DataBind();
            Rep.Visible = true;
        }
        else
            Rep.Visible = false;
    }
    protected void repComments_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
        {
            CommentItem row = (CommentItem)e.Item.DataItem;
            CustomerItem customer = CustomerManager.GetCustomer(row.CustomerID);
 
            Literal litComment = (Literal)e.Item.FindControl("litComment");
            Button btnDelete = (Button)e.Item.FindControl("btnDelete");
 
            litComment.Text = "<span class=\"commentname\">" + customer.Firstname + " " + customer.Lastname + " - </span><span class=\"commentdate\">" + row.Created.ToString("dd.MM.yyyy HH:mm") + "</span>" + "<span class=\"commentmessage\">" + row.Comment + "</span>";
 
            if (row.CustomerID == 2)
            {
                btnDelete.CommandName = "Delete";
                btnDelete.CommandArgument = row.ID.ToString();
                btnDelete.Attributes.Add("onclick", "jConfirm('" + Resources.Language.Wineclub_PostCommentPopupMessage.Replace(Environment.NewLine, "<br />") + "', '" + Resources.Language.Wineclub_PostCommentPopupHeader + "', function(r) { if(r==true) __doPostBack(\"" + btnDelete.ClientID.Replace("_", "$") + "\", \"\"); }); return false;");
            }
            else
                btnDelete.Visible = false;
 
        }
    }
    protected void repComments_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        CommentItem currentComment = WineclubManager.GetComment(int.Parse(e.CommandArgument.ToString()));
        Repeater currentRep = (Repeater)source;
        switch (e.CommandName)
        {
            case "Delete":
                WineclubManager.DeleteComment(int.Parse(e.CommandArgument.ToString()));
                //GetPosts();
 
                BindInnerRepeaterComments(currentRep, currentComment.PostID);
 
                RadAjaxManager ra = (RadAjaxManager)(Page.FindControl("RadAjaxManager1"));
                ra.ResponseScripts.Add("javascript:InitCommentTextFields();");
 
                break;
        }
    }

Maria Ilieva
Telerik team
 answered on 13 Jul 2012
4 answers
129 views
Hi,

there is a strange behavior that I can't understand when I DoubleClick on a row.

Here is my javacript function that handle the RowDblClick:

var editedRowIndex;
function RowDblClick(sender, eventArgs)
{
    var gridMPA = $find("<%= gridMPA.ClientID %>");
    var editedRow;
     
    if (editedRowIndex)
    {
        editedRow = gridMPA.get_masterTableView().get_dataItems()[editedRowIndex];
        if (editedRow.get_isInEditMode())
        {
            gridMPA.get_masterTableView().updateItem(editedRow.get_itemIndexHierarchical());
        }
    }
    editedRowIndex = eventArgs.get_itemIndexHierarchical();
    gridMPA.get_masterTableView().editItem(editedRowIndex);
}

If you look at it, is seems to works and it does, but only in chrome debug. If I just run it normally, the editedRow doesn't get updated, but if I run it in debug using Chrome debug and execute line per line, it works. So why this is happenning?

Thanks.
Andrey
Telerik team
 answered on 13 Jul 2012
1 answer
230 views
Hello,

When I create new RadWindow on page (by using JS radopen function) It creates horizontal and vertical scrollbar on host form element. I digged this and it is caused by bigger than orginal restrictionZoneID form. For example when "form" element has 1900x1040px the "TelerikModalOverlay" has 1920x1044px. (see attached file)

Is there any method to avoid this?

My code:

<asp:Content ID="Main" runat="server" contentplaceholderid="PlaceHolderMain">
         
         
        <telerik:RadFormDecorator ID="RadFormDecorator" Skin="Office2007" runat="server" />
        <telerik:RadWindowManager ID="RadWindowManager" ShowContentDuringLoad="false" VisibleStatusbar="false" ReloadOnShow="true"
                                  EnableShadow="true" Skin="Office2007" runat="server" >
            <Windows>
                 
                <telerik:RadWindow ID="RZPositionPickerRadWindow" Title="Wybierz rachunek zamkniÄ™ty" NavigateUrl="ReconnetRZPositionsPickerDialog.aspx" Modal="true"
                                   Width="1000" Height="550" Skin="Office2007" Behaviors="Move, Close, Resize" EnableShadow="false"
                                   OnClientClose="RZPositionPickerRadWindow_OnClose" EnableViewState="false" RestrictionZoneID="aspnetForm" runat="server">
                </telerik:RadWindow>
            </Windows>
        </telerik:RadWindowManager>
</asp:Content>
Svetlina Anati
Telerik team
 answered on 13 Jul 2012
4 answers
190 views
Dear support team,

i cannot upload a file to my server.
I use the example from "http://demos.telerik.com/aspnet-ajax/upload/examples/async/monitorprogress/defaultvb.aspx?product=asyncupload".
In the "TargetFolder" property i use a Virtual Directory from my IIS "TestDir". e.x. TargetFolder="TestDir"
The file is NOT uploaded and i do not receive any error message.
Can you please help me to save my file in the server?

I have latest version.

Thank you in advance for you time.
Best regards,
George.

<script type="text/javascript">
        function fileUploaded(sender, args) {
            var name = args.get_fileName();
            var $ = $telerik.$;
 
            $(".info-panel").
                append($("<div>" + name + "</div>")).show();
        }
</script>
 
<div class="upload-panel">
                    <%-- For the purpose of this demo the files are discarded.
             In order to store the uploaded files permanently set the TargetFolder property to a valid location. --%>
                    <telerik:RadAsyncUpload runat="server" ID="AsyncUpload1" OnClientFileUploaded="fileUploaded"
                        MultipleFileSelection="Automatic" TargetFolder="~/ImportPPC">
                    </telerik:RadAsyncUpload>
                    <telerik:RadProgressArea runat="server" ID="RadProgressArea1">
                    </telerik:RadProgressArea>
                </div>
                <div class="info-panel">
                    Uploaded files in the target folder:
                    <br />
                </div>

 
Peter Filipov
Telerik team
 answered on 13 Jul 2012
1 answer
84 views
Hi,

I have a grid and in that i have by default sorting by date desc and default group by by date and i is by default expended. The problem is that the sorting order is desc of date but the date is only taking the date and the month part in the not measuring by the sorting.
 
Please see the attachment.

I have used following code for sorting and grouping

 <SortExpressions >
                            <telerik:GridSortExpression FieldName="UpdatedDate" SortOrder="Descending"/>
                        </SortExpressions>
  <GroupByExpressions>
                            <telerik:GridGroupByExpression>
                                <GroupByFields>
                                    <telerik:GridGroupByField FieldName="UpdatedDate" SortOrder="Descending"  FormatString="{0:yy/mm/dd}" />
                                </GroupByFields>
                                <SelectFields>
                                    <telerik:GridGroupByField FieldName="UpdatedDate" />
                                </SelectFields>
                            </telerik:GridGroupByExpression>
                        </GroupByExpressions>
                        <GroupHeaderTemplate>
                            <asp:Label Text='<%#String.Format("{0:MM/dd/yy}", Eval("UpdatedDate"))%>' runat="server"
                                ID="lblDate" Style="font-weight: bold; color: Black;"></asp:Label>
                        </GroupHeaderTemplate>
Andrey
Telerik team
 answered on 13 Jul 2012
1 answer
250 views
Have an aggravating problem here and any help would be great.  Basically one of our clients beefed up their security and implemented OWASP.  Now, some of our existing site functionality is returning a security violation.  I narrowed down one of the major issues to the RadTab.  Once a page containing a RadTabStrip strip posts back, the OWASP returns a security violation.  Unfortunately, we don't have access to the logs and the client has given us a few snippets but they seem to be SQL Injection related and also pattern matching on the view state.

I then created a blank page with one RadTabStrip with 4 RadTab/RadPageViews, each containing a letter of the alphabet and one button that would post back.  Upon clicking the button, the security violation threw.  So I am about 99.99% positive it is returning a false-positive with something the RadTab is posting back.  I then modified one of our existing pages to implement JQuery tabs instead of the RadTabs.  This worked successfully, but the problem is this would be a somewhat lengthy overhaul and was hoping someone out there might have an idea for me.  Now please note that the client refuses to make any exceptions in the OWASP security.  Frustrating, but this is what I have to deal with.


Genady Sergeev
Telerik team
 answered on 13 Jul 2012
1 answer
136 views
Hi,

I am using rad bar chart with the scrolling option. It works fine. But the scroll appear inside the plot area, so I cannot able to view least value in the chart. For example in the YAxis I have value like 0, 1000, 2000, 3000, 4000 etc... In XAxis I have one value with 100, the scroll overlap on the plot area and it shows only the half of the bar height. How do I set the scroll out side the plot area, or any other way to do that. (And I need scroll mode only in 'XOnly')Thanks in advance.
Evgenia
Telerik team
 answered on 13 Jul 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?