Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
495 views
Hi,
I've got a RadCalendar control that has autopostback set to true. I am handling the event that fires when the selected date is changed on the rad calendar. However, when the calendar view is changed by using the fast navigation controls, a post back occurs. How do I stop that postback from happening?

Thanks
EmpowerIT
Top achievements
Rank 2
 answered on 25 Oct 2011
13 answers
252 views
Hi,

Seems like Telerik Scheduler is quite good.

I need extra option though.

I need to have couple of extra fields available for the form where appointment gets created. Those fields are in different underlying tables so I need the way to have those fields values pushed into those tables. Then I need to have them populated back into edit appointment form.

I would appreciate if you can get me a snippet.

Regards, Anvar
brian
Top achievements
Rank 1
 answered on 24 Oct 2011
3 answers
147 views
I have a scenario in which I have a RadGrid with in-place editing enabled. Several of the columns have custom editors referenced by the ColumnEditorID attribute, and all of the column editors in the grid are Telerik controls. I am catching the ItemCommand event in the code-behind to process the grid commands. The AllowMultiRowEdit attribute of the grid is set to false.

If I click Edit on one of the rows, the row goes into Edit mode correctly, and all of the formatting rules for each column editor are respected (e.g. I have a currency column that displays with a dollar sign and two decimal places, an integer column that displays with no decimal places and no commas, and the numeric columns are aligned right). Now, if I click Edit on a different row, the row that was previously in Edit mode exits edit mode and the second row that was clicked goes into Edit mode, again, as expected. However, the column editors in the second row have now lost the formatting rules. The currency column displays with no dollar sign, the integer column displays with decimal places and commas, and the numeric columns are no longer aligned right.

Note that the formatting is only lost on the editors themselves. The cells, when in view mode, retain their appropriate formatting.

Here is my grid:

<telerik:RadGrid
                                ID="grdChecksIssued" runat="server" GridLines="None"
                                AllowPaging="True" AllowAutomaticUpdates="true"
                                AllowAutomaticDeletes="True" AllowAutomaticInserts="false"
                                AllowSorting="True" AutoGenerateColumns="False" AllowMultiRowEdit="false">
                                <headercontextmenu cssclass="GridContextMenu GridContextMenu_Default"
                                    enableimagesprites="True">
                                </headercontextmenu>
                                <mastertableview CommandItemDisplay="Top" AllowSorting="true" TableLayout="Fixed"
                                    CommandItemSettings-AddNewRecordText="Add Issued Check"
                                    AllowMultiColumnSorting="false" EditMode="InPlace"
                                    InsertItemDisplay="Bottom" AutoGenerateColumns="false"
                                    NoMasterRecordsText="No checks issued today.">
                                    <commanditemsettings ShowRefreshButton="False" />
                                    <Columns>
                                        <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">
                                            <HeaderStyle Width="50px" />
                                        </telerik:GridButtonColumn>
                                        <telerik:GridEditCommandColumn UniqueName="EditCommandColumn1" UpdateText="Save" InsertText="Save">
                                            <HeaderStyle Width="50px" />
                                            <ItemStyle cssclass="EditColumn" />
                                        </telerik:GridEditCommandColumn>
                                        <telerik:GridNumericColumn DataField="PPIssuedID" DataType="System.Int64"
                                            HeaderText="PPIssuedID" SortExpression="PPIssuedID"
                                            UniqueName="PPIssuedID" Visible="False">
                                        </telerik:GridNumericColumn>
                                        <telerik:GridNumericColumn DataField="UserID" DataType="System.Int64"
                                            HeaderText="UserID" SortExpression="UserID"
                                            UniqueName="UserID" Visible="False">
                                        </telerik:GridNumericColumn>
                                        <telerik:GridDropDownColumn DataField="AcctNo" DataType="System.Int64"
                                            HeaderText="Account" SortExpression="AcctNo" DataSourceID="odsPPAccounts"
                                            UniqueName="AcctNo" DropDownControlType="RadComboBox" ListTextField="DisplayNameAcct"
                                            ListValueField="AcctNo">
                                            <HeaderStyle Width="140px" />
                                            <ItemStyle CssClass="AcctNoColumn" />
                                        </telerik:GridDropDownColumn>
                                        <telerik:GridNumericColumn DataField="SerialNo" DataType="System.Int32" ColumnEditorID="gceSerialNo"
                                            HeaderText="Serial No." SortExpression="SerialNo" UniqueName="SerialNo">
                                            <HeaderStyle HorizontalAlign="Right" Width="75px" />
                                            <ItemStyle HorizontalAlign="Right" cssclass="SerialNoColumn" />
                                        </telerik:GridNumericColumn>
                                        <telerik:GridDateTimeColumn DataField="WriteDate" HeaderText="Write Date"
                                            SortExpression="WriteDate" UniqueName="WriteDate" DataFormatString="{0:MM/dd/yyyy}"
                                            DataType="System.DateTime" ColumnEditorID="gceWriteDate">
                                            <HeaderStyle Width="100px" />
                                        </telerik:GridDateTimeColumn>
                                        <telerik:GridNumericColumn DataField="Amount" HeaderText="Amount" ShowSortIcon="true"
                                            SortExpression="Amount" UniqueName="Amount" DataType="System.Decimal"
                                            NumericType="Currency" ColumnEditorID="gceAmount">
                                            <HeaderStyle Width="95px" HorizontalAlign="Right" />
                                            <ItemStyle HorizontalAlign="Right" CssClass="AmountColumn" />
                                        </telerik:GridNumericColumn>
                                        <telerik:GridBoundColumn DataField="Payee" HeaderText="Payee" ColumnEditorID="gcePayee"
                                            SortExpression="Payee" UniqueName="Payee" AllowSorting="true">
                                            <ItemStyle CssClass="IssCheckPayee" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridCheckBoxColumn DataField="IsVoid" DataType="System.Boolean"
                                            HeaderText="Void" SortExpression="IsVoid" UniqueName="IsVoid">
                                            <HeaderStyle Width="65px" />
                                        </telerik:GridCheckBoxColumn>
                                    </Columns>
                                </mastertableview>
                            </telerik:RadGrid>
                            <telerik:GridNumericColumnEditor ID="gceSerialNo" runat="server">
                                <NumericTextBox ID="NumericTextBox1" runat="server" MaxLength="10" MinValue="0" Width="45px">
                                    <NumberFormat DecimalDigits="0" GroupSeparator="" DecimalSeparator=" " />
                                    <EnabledStyle HorizontalAlign="Right" />
                                </NumericTextBox>
                            </telerik:GridNumericColumnEditor>
                            <telerik:GridNumericColumnEditor ID="gceAmount" runat="server">
                                <NumericTextBox ID="NumericTextBox2" runat="server" MinValue="0" MaxValue="999999999999999.99">
                                    <NumberFormat DecimalDigits="2" KeepTrailingZerosOnFocus="true"
                                        PositivePattern="$n" />
                                    <EnabledStyle HorizontalAlign="Right" Width="65px" />
                                </NumericTextBox>
                            </telerik:GridNumericColumnEditor>
                            <telerik:GridDateTimeColumnEditor ID="gceWriteDate" runat="server">
                                <TextBoxStyle Width="90px" />
                            </telerik:GridDateTimeColumnEditor>
                            <telerik:GridTextBoxColumnEditor ID="gcePayee" runat="server">
                                <TextBoxStyle Width="100px" />
                            </telerik:GridTextBoxColumnEditor>
                            <asp:ObjectDataSource ID="odsPPAccounts" runat="server"
                                DataObjectTypeName="clsDDA" SelectMethod="GetPPAccounts"
                                TypeName="WebLinks.PosPayMain" />

And here is my code-behind:

Private Sub grdChecksIssued_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles grdChecksIssued.ItemCommand
        Select Case e.CommandName
            Case RadGrid.InitInsertCommandName
                grdChecksIssued.MasterTableView.ClearEditItems()
            Case RadGrid.EditCommandName
                grdChecksIssued.MasterTableView.IsItemInserted = False
            Case RadGrid.PerformInsertCommandName, _
                 RadGrid.UpdateCommandName
                SaveRow(e.Item)
            Case RadGrid.DeleteCommandName
                Dim hshCells As New Hashtable()
                CType(e.Item, GridDataItem).ExtractValues(hshCells)
                DeleteRow(hshCells)
        End Select
    End Sub
 
    Private Sub grdChecksIssued_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles grdChecksIssued.NeedDataSource
        grdChecksIssued.DataSource = GetRows()
    End Sub

Any help would be greatly appreciated.

Thanks!
Michael
Top achievements
Rank 1
 answered on 24 Oct 2011
1 answer
55 views

Not exactly accurate, but telerik won't let me edit the title.

The grid is a list of documents the user has stored.  To view a stored document, I created the view link; within the ItemCommand event handler I create a file and stream it back to the user as shown below.  However, the javascript to open a window to facilitate the streaming never gets invoked (except in IE browsers).

This is in a user control, although I don't think that's important.  Here's the mark-up:

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        var mediaList = {};
 
        mediaList.get_AddDocumentModalUrl = function mediaList_getAddDocumentModalUrl() {
            return '<%= Page.ResolveClientUrl("~/MediaLibrary/Modals/AddDocument.aspx") %>';
        }
 
        mediaList.get_ViewDocumentModalUrl = function mediaList_getViewDocumentModalUrl(mimeType) {
            var url = '<%= Page.ResolveClientUrl("~/MediaLibrary/Modals/ViewDocument.aspx") %>' + '?type=' + mimeType;
            return url;
        }
 
        //On insert and update buttons click temporarily disables ajax to perform upload actions
        //for a more detailed description of why we need this.
        function conditionalPostback(sender, eventArgs) {
            var theRegexp = new RegExp("\.UpdateButton$|\.PerformInsertButton$", "ig");
            if (eventArgs.get_eventTarget().match(theRegexp)) {
                var upload = $find(window['UploadId']);
 
                //AJAX is disabled only if file is selected for upload (i.e., new documents)
                if (upload != null && upload.getFileInputs()[0].value != "") {
                    eventArgs.set_enableAjax(false);
                }
            }
        }
 
        function validateRadUpload(source, e) {
            e.IsValid = false;
 
            var upload = $find(source.parentNode.getElementsByTagName('div')[0].id);
            var inputs = upload.getFileInputs();
            for (var i = 0; i < inputs.length; i++) {
                //check for empty string or invalid extension
                if (inputs[i].value != "" && upload.isExtensionValid(inputs[i].value)) {
                    e.IsValid = true;
                    break;
                }
            }
        }
 
    </script>
</telerik:RadCodeBlock>
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
    <script type="text/javascript">
        mediaList.onAddDocumentWindowClosed = function mediaList.onAddDocumentWindowClosed(sender, eventArgs) {
            var returnValue = eventArgs.get_argument();
 
            if (!Utils.WasRadWindowCancelled(returnValue, true)) {
                __doPostBack('', '');
            }
        }
 
        mediaList.openAddDocumentWindow = function mediaList_openAddDocumentWindow() {
            Utils.OpenRadWindow
                (
                    mediaList.get_AddDocumentModalUrl(),
                    600,
                    400,
                    mediaList.onAddDocumentWindowClosed
                );
        }
 
        mediaList.openViewWindow = function mediaList_openViewWindow(mimeType) {
            document.getElementById("<%= streamFrame.ClientID %>").src = mediaList.get_ViewDocumentModalUrl(mimeType);
        }
    </script>
</telerik:RadScriptBlock>
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" ClientEvents-OnRequestStart="conditionalPostback">
    <asp:Panel ID="pnlMsg" runat="server">
        <asp:Label ID="lblMsg" runat="server" Style="color: Red; font-weight: bold;" />
    </asp:Panel>
 
    <telerik:RadGrid ID="grdDocumentLibrary" runat="server" Skin="Default" AutoGenerateColumns="false"
        Width="100%" AllowPaging="true" PageSize="10" OnItemDataBound="grdDocumentLibrary_ItemDataBound"
        AllowAutomaticInserts="false" AllowAutomaticUpdates="false" OnEditCommand="grdDocumentLibrary_Edit"
        OnUpdateCommand="grdDocumentLibrary_Update" OnInsertCommand="grdDocumentLibrary_Insert"
        OnItemCommand="grdDocumentLibrary_ItemCommand" OnItemCreated="grdDocumentLibrary_ItemCreated"
        ShowStatusBar="true">
        <PagerStyle Mode="NumericPages" AlwaysVisible="false" Position="Bottom" CssClass="Pager" />
        <MasterTableView CommandItemDisplay="Top" ClientDataKeyNames="DocumentID" DataKeyNames="DocumentID">
            <NoRecordsTemplate>
                <asp:Label Text="No documents to display" runat="server" /></NoRecordsTemplate>
            <Columns>
                <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditColumn">
                </telerik:GridEditCommandColumn>
                <telerik:GridBoundColumn DataField="DocumentID" Visible="false" ReadOnly="true" UniqueName="DocID" />
                <telerik:GridTemplateColumn HeaderText="Document Name" UniqueName="DocName" ReadOnly="false">
                    <ItemTemplate>
                        <asp:Label ID="lblDocName" runat="server" Text='<%#Eval("Name") %>' />
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadUpload ID="ruDocument" runat="server" MaxFileInputsCount="1" />
                        <asp:CustomValidator ID="cvDocument" runat="server" ClientValidationFunction="validateRadUpload"
                            ErrorMessage="Please select a file" Display="Dynamic" />
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Description" UniqueName="Description">
                    <ItemTemplate>
                        <asp:Label ID="lblDescription" runat="server" Text='<%# Eval("Description") %>' />
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadTextBox ID="txtDescription" runat="server" Text='<%# Bind("Description") %>'
                            Columns="50" Rows="5" TextMode="MultiLine" />
                        <des:RequiredTextValidator ID="rtvDescription" runat="server" ControlIDToEvaluate="txtDescription"
                            ErrorMessage="* Required" />
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn HeaderText="Date Created" DataField="CreatedDate" ReadOnly="true"
                    DataFormatString="{0:d}" />
                <telerik:GridBoundColumn HeaderText="Operator" DataField="CreatedBy" ReadOnly="true" />
                <telerik:GridImageColumn ImageUrl="~/Images/Tick.gif" HeaderText="Archived?" UniqueName="ArchivedColumn" />
                <telerik:GridTemplateColumn ReadOnly="true" UniqueName="ViewColumn">
                    <ItemTemplate>
                        <asp:LinkButton ID="lnkView" runat="server" Text="View" CommandArgument='<%#Eval("DocumentID") %>' CommandName="View" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
            <EditFormSettings>
                <EditColumn ButtonType="PushButton" />
            </EditFormSettings>
        </MasterTableView>
    </telerik:RadGrid>
</telerik:RadAjaxPanel>
 
<telerik:RadAjaxLoadingPanel ID="loadingPanel" runat="server" Skin="Default" />
<telerik:RadAjaxManagerProxy ID="ajaxProxy" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="grdDocumentLibrary">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="grdDocumentLibrary" LoadingPanelID="loadingPanel" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy>
<iframe id="streamFrame" style="width: 1%; height: 1%" frameborder="0" scrolling="no"
    runat="server"></iframe>

And the ItemCreated event handler, where I set up the "View" link.

protected void grdDocumentLibrary_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
 
        LinkButton btn = (LinkButton)((GridDataItem)e.Item)["ViewColumn"].FindControl("lnkView");
        Page page = HttpContext.Current.CurrentHandler as Page;
        Telerik.Web.UI.RadAjaxManager ajaxMgr = Telerik.Web.UI.RadAjaxManager.GetCurrent(page);
        if (ajaxMgr != null)
        {
            ajaxMgr.AjaxSettings.AddAjaxSetting(btn, grdDocumentLibrary, loadingPanel);
        }
    }
}

And here's where I handle the ItemCommand:

protected void grdDocumentLibrary_ItemCommand(object sender, GridCommandEventArgs e)
 {
     if (e.CommandName == RadGrid.InitInsertCommandName)
     {
         e.Canceled = true;
         e.Item.OwnerTableView.InsertItem(new PartnerDocument());
     }
     else if (e.CommandName.Equals("View"))
     {
         BernardClientContext bcc = BuildClientContext();
         DocumentService ds = new DocumentService(new DocumentRepository(bcc));
         Document doc = ds.GetById(new Guid((string)e.CommandArgument));
 
         string filePath = System.Configuration.ConfigurationManager.AppSettings["GeneratedDocuments"];
         if (HttpContext.Current != null)
         {
             filePath = HttpContext.Current.Server.MapPath(filePath);
         }
 
         string fileName = null;
         Mutex fileMutex = null;
         try
         {
             while (true)
             {
                 fileName = doc.FileName + "_" + System.DateTime.Now.ToString("ddMMyyyyhhmmss") + doc.DocumentType.Name;
 
                 bool created;
                 fileMutex = new Mutex(true, fileName.Replace("\\", "_"), out created);
                 if (fileMutex != null && created)
                 {
                     if (!System.IO.File.Exists(filePath + fileName))
                         break;
 
                     fileMutex.ReleaseMutex();
                 }
 
                 System.Threading.Thread.Sleep(1000);
             }
 
             File.WriteAllBytes(filePath + fileName, doc.DocumentContent.Content);
 
             Page page = HttpContext.Current.CurrentHandler as Page;
             Telerik.Web.UI.RadAjaxManager ajaxMgr = Telerik.Web.UI.RadAjaxManager.GetCurrent(page);
             Session["documentToStream"] = filePath + fileName;
             if (ajaxMgr != null)
             {
                 ajaxMgr.ResponseScripts.Add(String.Format("mediaList.openViewWindow('{0}'); return false;", doc.MimeType));
             }
             else
             {
                 page.ClientScript.RegisterStartupScript(page.GetType(), "documentStream", String.Format("mediaList.openViewWindow('{0}'); return false;", doc.MimeType), true);
             }
 
         }
         finally
         {
             if (fileMutex != null)
                 fileMutex.ReleaseMutex();
         }
     }
 }


Thanks,

Scott

golddog
Top achievements
Rank 1
 answered on 24 Oct 2011
2 answers
141 views
Hi

I have some serious performance issue in application due to over use of ViewState and Session. To maintain DataTable current state during postbacks, do we have any other possible way? Is binding possible without using NeedDataSource event.? How to keep the values during postbacks? If enable "EnableViewState=true" of RadGrid, can I get the DataSource values between postbacks?


Thanks in advance
Robert A Dennyson.
Robert Dennyson
Top achievements
Rank 2
 answered on 24 Oct 2011
2 answers
226 views
Hi All,

I have a scenario where in i have to use button outside the grid to add,modify,delete and submit the changes in a grid. Im able to trigger the "Add" itemcommand on button click when inserting new row but im not able to capture values which the user has inserted in the row.
e.Item.Cells[2].Text returns "&nbsp;"

Following is the code:

ASPX


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ManageSites.aspx.cs" Inherits="ManageSites" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<link rel="stylesheet" type="text/css" href="eSOMS.css" />
<SCRIPT language="javascript" src="Scripts/ShowError.js"></SCRIPT>
<script language="javascript" src="Scripts/MiscFunctions.js"></script>
<head runat="server">
    <title>Manage Sites</title>  
</head>
<body>
    <form id="form1" runat="server">
      <telerik:RadScriptManager ID="ScriptManager1" runat="server"></telerik:RadScriptManager>
        <telerik:RadAjaxPanel runat="server">
        <table>
        <tr>
            <td colspan="4">
                <telerik:RadGrid runat="server" ID="rgManageSites" AllowAutomaticUpdates="true"
                AllowAutomaticDeletes="true" EnableAsyncRequests="True" AllowAutomaticInserts="true">
                <ClientSettings Selecting-AllowRowSelect="true"></ClientSettings>
                <MasterTableView AutoGenerateColumns="false" EditMode="InPlace" AllowAutomaticInserts="True" AllowAutomaticUpdates="true" AllowAutomaticDeletes="true" CommandItemDisplay="Bottom">
                <Columns>
                     <telerik:GridBoundColumn HeaderText="Facility Id" DataField="Site_Code"></telerik:GridBoundColumn>
                     <telerik:GridBoundColumn HeaderText="Facility Description" DataField="Site_Description"></telerik:GridBoundColumn>
                     <telerik:GridBoundColumn HeaderText="TimeZone Offset" DataField="Time_Zone_Offset"></telerik:GridBoundColumn>
                </Columns>                 
                </MasterTableView>
                </telerik:RadGrid>
            </td>
        </tr>
        <tr>
            <td>
                    <asp:Button ID="btnAdd" runat="server"
                    Text="Add" Width="108px" CausesValidation="false" CssClass="StandardButton" OnClick="btnAdd_Click" CommandName="Add"/>
                 
            </td>
            <td>
                <asp:Button ID="btnDelete" runat="server"
                    Text="Delete" Width="108px" CausesValidation="false" CssClass="StandardButton" OnClick="btnDelete_Click"/>
            </td>
            <td>
                <asp:Button ID="btnModify" runat="server"
                    Text="Modify" Width="108px" CausesValidation="false" CssClass="StandardButton" OnClick="btnModify_Click"/>
            </td>
            <td>
                <asp:Button ID="btnClose" runat="server"
                    Text="Close" Width="108px" CausesValidation="false" CssClass="StandardButton" OnClick="btnClose_Click"/>
            </td>
        </tr>
        </table>
        </telerik:RadAjaxPanel>
    </form>
</body>
</html>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Telerik.Web.UI;
using System.Text;
using TechAssist.Data;
 
public partial class ManageSites : System.Web.UI.Page
{
    string userId;
    DataTable dtSites;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            userId = TechAssist.eSOMS.SharedCommon.CommonUtil.GetUserID();
            dtSites = GetMultiSites().Tables[0]; // returns Datatable as source
            ViewState["dtSites"] = dtSites; // storing it in Viewstate
            rgManageSites.DataSource = dtSites;
             
        }
        else
        {
            //rgManageSites.DataSource = ViewState["dtSites"];
        }
        rgManageSites.ItemCreated += new GridItemEventHandler(rgManageSites_ItemCreated);
        rgManageSites.ItemCommand += new GridCommandEventHandler(rgManageSites_ItemCommand);
    }
    void rgManageSites_ItemCommand(object sender, GridCommandEventArgs e)
    {
        switch (e.CommandName)
        {
            case "Add":
                {                   
                    if ((e.Item is GridDataInsertItem) && e.Item.IsInEditMode)
                    {
                        //e.Item.Cells[2].Text -- returns   
                    }
                    rgManageSites.Rebind();
 
                    break;
                }
        }
    }
    void rgManageSites_ItemCreated(object sender, GridItemEventArgs e)
    {
        if ((e.Item is GridDataInsertItem) && e.Item.IsInEditMode)
        {
            //init insert operation triggered  
        }
        else if ((e.Item is GridEditableItem) && e.Item.IsInEditMode)
        {
            //edit operation triggered  
        }
    }
    protected void btnClose_Click(object sender, EventArgs e)
    {
    }
 
    protected  void btnModify_Click(object sender, EventArgs e)
    {
         
    }
 
    protected void btnDelete_Click(object sender, EventArgs e)
    {
    }
 
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        rgManageSites.MasterTableView.IsItemInserted = true;
        if (btnAdd.Text == "Add")
        {
            rgManageSites.DataSource = ViewState["dtSites"];
            rgManageSites.MasterTableView.InsertItem();// = true; 
            btnAdd.Text = "Apply Add";
 
        }
        else if (btnAdd.Text == "Apply Add")
        {
            btnAdd.Text = "Add";
 
            GridEditableItem insertedItem = rgManageSites.MasterTableView.GetInsertItem();
            insertedItem.FireCommandEvent("Add", String.Empty);
        
    }
    private DataSet GetMultiSites()
    {
        StringBuilder sb = new StringBuilder("select US.SITE_CODE,S.SITE_Description,S.Time_Zone_Offset from user_sites US, Sites S ");
        sb.Append("where US.SITE_CODE = S.SITE_CODE and user_id = '");
 
        sb.Append(userId);
        sb.Append("'");
 
        TechAssist.Data.Database db = new Database();
        TechAssist.Data.DataAdapter da = new TechAssist.Data.DataAdapter(sb.ToString());
        DataSet dsSites = new DataSet();
        try
        {
            da.Fill(dsSites, "Sites");
        }
        catch (System.Exception ex)
        {
            TechAssist.eSOMS.SharedCommon.CommonUtil.SetErrorPopup(
            Page.FindControl("txtErrorMessage"), ex);
 
        }
        return dsSites;
    }
}

Can anyone please tell me how do i capture the values from the newly inserted row?

Thanks,
Vijay
Vijay
Top achievements
Rank 1
 answered on 24 Oct 2011
2 answers
55 views
Hello,

I have a RadGrid instance that uses the OnRowContextMenu client event to show a pop-up menu. It works perfectly.

However, the right-click context menu behavior isn't always intuitive to my users - so I'd like to add a small drop-down image to each row (in a specific column). When the drop-down image is left-clicked, I would like the "OnRowContextMenu" behavior to be invoked.

How can I accomplish this task?
Mark
Top achievements
Rank 1
 answered on 24 Oct 2011
4 answers
110 views
Hi, I'm testing an existing site on DNN 6.0 and I've got a problem with the export feature of radgrid. Works fine in DNN 5.6 but when I try it on DNN 6.0 the screen goes white during post back and never returns to the page. The file dialog opens up to save, open or cancel, but after you do anything the page with the radgrid stays white. If I refresh the page it works ok. 

I'm using an external button to do the export and to get it work under DNN 5.6 I had to disable postback (see code below). If I remove that code the pdf output and the excel output show up inside the radgrid, but you can't save it.

Not sure how to tackle this?

Thanks, all help is appreciated.



Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(initializeRequestHandler);
 
function initializeRequestHandler(sender, args) {
    if (args.get_postBackElement().id.indexOf("ExportPDFButton") != -1) {
        args.set_cancel(true);
        sender._form["__EVENTTARGET"].value = args.get_postBackElement().id.replace(/\_/g, "$");
        sender._form["__EVENTARGUMENT"].value = "";
        sender._form.submit();
        return;
    }
 
    if (args.get_postBackElement().id.indexOf("ExportExcelButton") != -1) {
        args.set_cancel(true);
        sender._form["__EVENTTARGET"].value = args.get_postBackElement().id.replace(/\_/g, "$");
        sender._form["__EVENTARGUMENT"].value = "";
        sender._form.submit();
        return;
    }
Tim
Top achievements
Rank 1
 answered on 24 Oct 2011
4 answers
334 views
If we add a value to a RadComboBoxItem attribute, we can always read it from the client side by saying
var value = combo.get_selectedItem().get_attributes().getAttribute('MyAttribute');


Can we do something similar for grid? During the ItemDataBound, I want to add attribute to each DataItem and read it when a row is selected and deselected clientside.

Thanks.
Baal
Top achievements
Rank 1
 answered on 24 Oct 2011
1 answer
49 views
Hi,

Can we bind our own data format to Scheduler control? 

Please provide us a example of Scheduler with database driven instead of XML.
Peter
Telerik team
 answered on 24 Oct 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?