Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
133 views
I've tried to make this work correctly using multiple methods, however when a user would click the Edit Button on one of the Internal RadGrid items it loses track of the row that is being edited. Thus shows in the background all possible rows, and does not know what the values were of the record being edited.

Attached is the ASPX and Code Behind for reference.

<%@ Page Title="" Language="C#" AutoEventWireup="true" CodeBehind="Test2.aspx.cs"
    Inherits="mtc_knowledgebase.Test2" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<head id="Head1" runat="server">
    <style type="text/css">
        span.riSingle
        {
            position: static;
        }
    </style>
</head>
<body class="BODY">
    <form runat="server" id="mainForm" method="post">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
    <telerik:RadGrid AllowSorting="True" AutoGenerateColumns="False" DataSourceID="DNDataSource"
        ID="DNGrid" runat="server" GridLines="Both" AllowPaging="true" AllowFilteringByColumn="true"
        CssClass="span.riSingle" OnItemCommand="DNGrid_OnItemCommand">
        <MasterTableView CommandItemDisplay="Bottom" DataKeyNames="dn_hdr_id" EditMode="PopUp"
            Name="HeaderGrid" AllowAutomaticInserts="true" AllowAutomaticUpdates="true">
            <NestedViewTemplate>
                <asp:Panel runat="server" ID="InnerContainer">
                    <telerik:RadTabStrip runat="server" ID="TabStip1" MultiPageID="Multipage1" SelectedIndex="0"
                        DataFieldParentID="dn_hdr_id">
                        <Tabs>
                            <telerik:RadTab runat="server" Text="DN Items" PageViewID="ItemView">
                            </telerik:RadTab>
                            <telerik:RadTab runat="server" Text="DN Approvals" PageViewID="ApprovalView">
                            </telerik:RadTab>
                        </Tabs>
                    </telerik:RadTabStrip>
                    <telerik:RadMultiPage runat="server" ID="Multipage1" SelectedIndex="0" RenderSelectedPageOnly="false">
                        <telerik:RadPageView runat="server" ID="ItemView">
                            <telerik:RadGrid AllowSorting="True" AutoGenerateColumns="False" DataSourceID="DNDtlDataSource"
                                ID="DetailGrid" runat="server" GridLines="Both" CssClass="span.riSingle" BackColor="Azure"
                                HeaderStyle-ForeColor="DimGray" HeaderStyle-BorderColor="DarkGoldenrod" HeaderStyle-BorderWidth="2px"
                                OnInsertCommand="GridOnInsert" OnUpdateCommand="GridOnUpdate" OnItemCommand="GridGetId">
                                <MasterTableView CommandItemDisplay="Bottom" DataKeyNames="dn_dtl_id,dn_hdr.dn_hdr_id"
                                    EditMode="PopUp" Name="DetailGrid">
                                    <CommandItemSettings ShowExportToExcelButton="false" ShowRefreshButton="false" AddNewRecordText="Add New Detail Record" />
                                    <EditFormSettings EditColumn-ButtonType="PushButton" EditColumn-UpdateText="Process Update"
                                        PopUpSettings-Modal="true" PopUpSettings-Width="85%" />
                                    <Columns>
                                        <telerik:GridBoundColumn UniqueName="DTL_DN_DTL_ID" DataField="dn_dtl_id" ReadOnly="true"
                                            Visible="false" />
                                        <telerik:GridEditCommandColumn EditText="EDIT" UniqueName="btnEdit" ButtonType="PushButton" />
                                        <telerik:GridAttachmentColumn DataSourceID="DNDtlDataSource2" MaxFileSize="10485760"
                                            EditFormHeaderTextFormat="Upload File:" HeaderText="Attachment" AttachmentDataField="dn_file_att"
                                            AttachmentKeyFields="dn_dtl_id" FileNameTextField="dn_file_nm" DataTextField="dn_file_nm"
                                            UniqueName="DTL_AttachmentColumn" AllowedFileExtensions=".pdf,.jpg" />
                                        <telerik:GridBoundColumn UniqueName="DTL_CREAT_BY" HeaderText="Created By" DataField="creat_by"
                                            ReadOnly="true" />
                                        <telerik:GridBoundColumn UniqueName="DTL_CREAT_DT" HeaderText="Date Created" DataField="creat_dt"
                                            ReadOnly="true" DataFormatString="{0:MM/dd/yy}" />
                                        <telerik:GridBoundColumn UniqueName="DTL_UPDT_BY" HeaderText="Last Updated By" DataField="updt_by"
                                            ReadOnly="true" />
                                        <telerik:GridBoundColumn UniqueName="DTL_UPDT_DT" HeaderText="Last Updated" DataField="updt_dt"
                                            DataFormatString="{0:MM/dd/yy}" ReadOnly="true" />
                                    </Columns>
                                </MasterTableView>
                            </telerik:RadGrid>
                        </telerik:RadPageView>
                        <telerik:RadPageView runat="server" ID="ApprovalView">
                            <telerik:RadGrid AllowSorting="True" AutoGenerateColumns="False" ID="ApprovalGrid"
                                DataSourceID="DNDataSource2" runat="server" GridLines="Both" CssClass="span.riSingle"
                                BackColor="Azure" EnableViewState="true" HeaderStyle-ForeColor="DimGray" HeaderStyle-BorderColor="DarkGoldenrod"
                                HeaderStyle-BorderWidth="2px">
                                <MasterTableView CommandItemDisplay="Bottom" DataKeyNames="dn_hdr_id" EditMode="PopUp"
                                    Name="ApprovalGridMaster">
                                    <CommandItemSettings ShowExportToExcelButton="false" ShowRefreshButton="false" ShowAddNewRecordButton="false" />
                                    <EditFormSettings EditColumn-ButtonType="PushButton" EditColumn-UpdateText="Process Update"
                                        PopUpSettings-Modal="true" PopUpSettings-Width="85%" />
                                    <Columns>
                                        <telerik:GridEditCommandColumn EditText="EDIT" UniqueName="btnEdit" ButtonType="PushButton" />
                                        <telerik:GridBoundColumn UniqueName="QR_NM" HeaderText="Quality Signoff" DataField="qr_nm" />
                                        <telerik:GridDateTimeColumn UniqueName="QR_DT" HeaderText="Quality Signoff Date"
                                            DataField="qr_dt" DataFormatString="{0:MM/dd/yy}" />
                                    </Columns>
                                </MasterTableView>
                            </telerik:RadGrid>
                        </telerik:RadPageView>
                    </telerik:RadMultiPage>
                </asp:Panel>
            </NestedViewTemplate>
            <Columns>
                <telerik:GridEditCommandColumn EditText="EDIT" UniqueName="btnEdit" ButtonType="PushButton" />
                <telerik:GridBoundColumn UniqueName="dn_hdr_id" HeaderText="DN ID" DataField="dn_hdr_id"
                    ReadOnly="true" />
                <telerik:GridBoundColumn UniqueName="SUP_NM" HeaderText="Operator/Supervisor" DataField="sup_nm" />
                <telerik:GridDateTimeColumn UniqueName="SUP_DT" HeaderText="O/S Date" DataField="sup_dt"
                    DataFormatString="{0:MM/dd/yy}" />
            </Columns>
        </MasterTableView>
        <ClientSettings AllowKeyboardNavigation="true">
            <Scrolling AllowScroll="true" ScrollHeight="600px" />
        </ClientSettings>
        <ExportSettings ExportOnlyData="true" IgnorePaging="true" />
    </telerik:RadGrid>
    <asp:EntityDataSource ID="DNDataSource" runat="server" ConnectionString="name=mtc_kbaseEntities"
        DefaultContainerName="mtc_kbaseEntities" EntitySetName="dn_hdr" OrderBy="it.updt_dt"
        Include="cust, prt, orig_1" EnableInsert="true" EnableUpdate="true">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="DNDataSource2" runat="server" ConnectionString="name=mtc_kbaseEntities"
        DefaultContainerName="mtc_kbaseEntities" EntitySetName="dn_hdr" EnableUpdate="true">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="DNDtlDataSource2" runat="server" ConnectionString="name=mtc_kbaseEntities"
        DefaultContainerName="mtc_kbaseEntities" EntitySetName="dn_dtl">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="DNDtlDataSource" runat="server" ConnectionString="name=mtc_kbaseEntities"
        DefaultContainerName="mtc_kbaseEntities" EntitySetName="dn_dtl" Include="orig_2">
    </asp:EntityDataSource>
    </form>
</body>
</html>

Code Behind
using System;
using System.Data;
using System.Linq;
using System.Web;
using Telerik.Web.UI;
  
namespace mtc_knowledgebase
{
    public partial class Test2 : System.Web.UI.Page
    {
        #region Variables
        private int _dnHdrId;
        private int _dnDtlId;
        private string _fileName;
        private byte[] _fileData;
        private string _curUser;
        private DateTime? _curDt;
        private int _errLevel;
        #endregion
        protected void Page_Load(object sender, EventArgs e)
        {
            DNDtlDataSource2.Where = "it.dn_dtl_id == 0";
        }
  
        /// <summary>
        /// This will be used in place of the auto insert event based on File Attachment requirements
        /// </summary>
        /// <param name="sender">
        /// This method is called on the Grid Insert Event
        /// </param>
        /// <param name="e">
        /// The entire Inserted record will be passed
        /// </param>
        protected void GridOnInsert(object sender, GridCommandEventArgs e)
        {
            if ("DetailGrid".Equals(e.Item.OwnerTableView.Name))
            {
                var editItem = e.Item as GridEditableItem;
                GetRecordInfo(editItem);
                if (_errLevel == 0)
                {
                    try
                    {
                        using (var db = new mtc_kbaseEntities())
                        {
                            var newDnDtl = new dn_dtl
                            {
                                dn_hdrReference = { EntityKey = new EntityKey("mtc_kbaseEntities.dn_hdr", "dn_hdr_id", _dnHdrId) },
                                dn_file_nm = _fileName,
                                dn_file_att = _fileData,
                                creat_by = _curUser,
                                creat_dt = _curDt,
                                updt_by = _curUser,
                                updt_dt = _curDt
                            };
                            db.AddTodn_dtl(newDnDtl);
                            db.SaveChanges();
                        }
                    }
                    catch (Exception ex)
                    {
                        Response.Write("<script type=\"text/javascript\" language=\"javascript\">");
                        Response.Write("alert('" + ex.Message + "');");
                        Response.Write("</script>");
                    }
                }
            }
        }
  
        /// <summary>
        /// This will be used in place of the auto update event based on File Attachment requirements
        /// </summary>
        /// <param name="sender">
        /// This method is called on the Grid Update Event
        /// </param>
        /// <param name="e">
        /// The entire Updated record will be passed
        /// </param>
        protected void GridOnUpdate(object sender, GridCommandEventArgs e)
        {
            if ("DetailGrid".Equals(e.Item.OwnerTableView.Name))
            {
                var editItem = e.Item as GridEditableItem;
                _dnDtlId = Convert.ToInt32((editItem.EditManager.GetColumnEditor("DTL_DN_DTL_ID") as GridTextBoxColumnEditor).Text);
                GetRecordInfo(editItem);
                if (_errLevel == 0)
                {
                    try
                    {
                        using (var db = new mtc_kbaseEntities())
                        {
                            var updDtl = db.dn_dtl.First(t => t.dn_dtl_id == _dnDtlId);
                            updDtl.dn_file_nm = _fileName;
                            updDtl.dn_file_att = _fileData;
                            updDtl.updt_by = _curUser;
                            updDtl.updt_dt = _curDt;
                            db.SaveChanges();
                        }
                    }
                    catch (Exception ex)
                    {
                        Response.Write("<script type=\"text/javascript\" language=\"javascript\">");
                        Response.Write("alert('" + ex.Message + "');");
                        Response.Write("</script>");
                    }
                }
            }
        }
  
        /// <summary>
        /// If a request for the file download is initiated, this will update the datasource
        /// </summary>
        /// <param name="sender">
        /// The datasource for the attachment requires the ID of the record
        /// </param>
        /// <param name="e">
        /// Only fire the event if it's a download request
        /// </param>
        protected void GridGetId(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == "DownloadAttachment")
            {
                var args = e as GridDownloadAttachmentCommandEventArgs;
                _dnDtlId = (int)args.AttachmentKeyValues["dn_dtl_id"];
                DNDtlDataSource2.Where = "it.dn_dtl_id == " + _dnDtlId;
            }
        }
  
        /// <summary>
        /// This is a common method for setting variables based on the attachment details
        /// </summary>
        /// <param name="editItem">
        /// The edit item.
        /// </param>
        protected void GetRecordInfo(GridEditableItem editItem)
        {
            _errLevel = 0;
            RadUpload upload = ((GridAttachmentColumnEditor)editItem.EditManager.GetColumnEditor("DTL_AttachmentColumn")).RadUploadControl;
            if (upload.InvalidFiles.Count > 0)
            {
                _errLevel = 1;
                Response.Write("<script type=\"text/javascript\" language=\"javascript\">");
                Response.Write("alert('Only PDF or JPG files smaller than 10MB are allowed');");
                Response.Write("</script>");
                return;
            }
  
            if (upload.UploadedFiles.Count != 0)
            {
                _fileName = upload.UploadedFiles[0].GetName();
                _fileData = ((GridAttachmentColumnEditor)editItem.EditManager.GetColumnEditor("DTL_AttachmentColumn")).UploadedFileContent;
            }
  
            _curUser = HttpContext.Current.User.Identity.Name.ToString().Replace("MORGANGROUPPLC\\", string.Empty);
            _curDt = DateTime.Now;
        }
  
        protected void DNGrid_OnItemCommand(object sender, GridCommandEventArgs e)
        {
            GridDataItem grdDataitem = (GridDataItem)e.Item;
  
            if (e.CommandName == RadGrid.ExpandCollapseCommandName)
            {
                _dnHdrId = (int)grdDataitem.GetDataKeyValue("dn_hdr_id");
                DNDtlDataSource.Where = "it.dn_hdr.dn_hdr_id == " + _dnHdrId;
                DNDataSource2.Where = "it.dn_hdr_id == " + _dnHdrId;
            }
        }
    }
}
Andrey
Telerik team
 answered on 13 Jul 2012
1 answer
142 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
176 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
168 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
128 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
224 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
185 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
81 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
247 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?