Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
183 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
281 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 " "

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
81 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
148 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
415 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
70 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
1 answer
137 views

Hi,
I was provided with source code of VS project that uses Telerik controls. It's a WebSite and has dll's in Bin folder.
Telerik controls  version is 2010.2.826.40.

There is no Telerik.Web.Design.dll file in the project folders, but it's referenced in web.config file. I haven’t installed any Telerik package before, neither now because i have only project files.

Is there any way to proper see controls in VS 2010 editor and not getting error "Failed to create designer" without having file Telerik.Web.Design.dll? I've tried solutions from the forum and errors with references/sourcecode disappeared. However design view in VS 2010 is still not working.


Thanks in advance,
Przemek
Andrey
Telerik team
 answered on 24 Oct 2011
3 answers
96 views

I am having trouble getting this to work i looked into loading flash videos from the database and adding them to a virtual forlder where they can be choose from. 

I've looked at :

http://demos.telerik.com/aspnet-ajax/editor/examples/dbfilebrowsercontentprovider/defaultcs.aspx
http://www.telerik.com/help/aspnet-ajax/editor-custom-filebrowsercontentprovider.html
http://www.telerik.com/help/aspnet-ajax/radfileexplorer-custom-filebrowsercontentprovider.html
http://www.telerik.com/community/code-library/aspnet-ajax/file-explorer/connect-radfileexplorer-or-radeditor-to-a-sql-databse.aspx


I have put everything in my sharepoint application, and i get no errors but, the implementation that i have is not reading the database, it skips the overrides and goes straight to the default methods. 

I am guessing it has to do with adding the handlers ahxs files to the project, but i am not sure how to do it in the sharepoint projec, where is a good place to add them? 

also I am working with the Sharepoint RadEditor
http://sharepoint.telerik.com/aspnet-ajax/Pages/RadEditor-for-SharePoint.aspx

I hope this is not part of the problem. 

Thanks
Daniel
Top achievements
Rank 1
 answered on 24 Oct 2011
1 answer
101 views
When, I tried to select 2000 files (.txt) at once using RadAsyncUpload - MultipleFileSelection and click "Open" button then I get the following error:

Microsoft JScript runtime error: Unhandled Error in Silverlight Application ShowDialog failed.   at System.Windows.Controls.OpenFileDialog.ShowDialog()
   at UploadPrototype.MainPage.OpenDialog()
   at UploadPrototype.MainPage.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)

I had observed that I could not upload more than 2000 files(.txt) at once using RadAsyncUpload.
Is there any limitation with RadAsyncUpload?
If not, how do I overcome this limitation?
Peter Filipov
Telerik team
 answered on 24 Oct 2011
5 answers
162 views
Dear Support

Please find the attached image and understand the issue. How to make the necessary changes? Please suggest


<telerik:RadGrid ID="RadGrid1" Width="100%" BackColor="Transparent"
                                runat="server" AllowPaging="true" AutoGenerateColumns="false" OnItemCommand="RadGrid1_ItemCommand"
                                OnNeedDataSource="RadGrid1_NeedDataSource" AllowSorting="true" OnItemDataBound="RadGrid1_ItemDataBound"
                                OnItemCreated="RadGrid1_ItemCreated" Skin="Black" BorderWidth="1"  AlternatingItemStyle-BackColor="White"
                                AllowFilteringByColumn="true" OnInit="RadGrid1_Init">
                                <PagerStyle Mode="NextPrevAndNumeric" Position="Bottom" />
                                <GroupingSettings CaseSensitive="false" />
                                <FilterMenu CssClass="FilterMenu" ForeColor="White" />
                                <FilterItemStyle BorderWidth="0px" BorderColor="White" VerticalAlign="Top" HorizontalAlign="Left" />
                                <HeaderStyle Font-Bold="true" CssClass="FontFamily"></HeaderStyle>
                              
                                <MasterTableView DataKeyNames="PID" FilterItemStyle-HorizontalAlign="Left"
                                    CellPadding="0" CellSpacing="0" Width="100%" FilterItemStyle-BackColor="White"
                                    BorderWidth="0" ForeColor="Black" BackColor="White">
                                    <Columns>
                                        <telerik:GridTemplateColumn AllowFiltering="false" ItemStyle-BorderWidth="1px" HeaderStyle-BorderWidth="1px"
                                            HeaderStyle-BorderColor="#666666">
                                            <ItemTemplate>
                                                <img src='../Images/Edit.gif' alt='Edit' class="MouseHoverLink" title='Edit' onclick='<%# "OpenWindow1(" +Eval("PID") + " );" %>' />
                                            </ItemTemplate>
                                            <ItemStyle Width="9%" HorizontalAlign="Left" />
                                            <HeaderStyle Width="9%" HorizontalAlign="Left" />
                                        </telerik:GridTemplateColumn>
                                        <telerik:GridBoundColumn DataField="ShortName" HeaderText="Name" SortExpression="ShortName"
                                            UniqueName="ShortName" Visible="True" ItemStyle-BorderWidth="1px" HeaderStyle-BorderWidth="1px"
                                            HeaderStyle-BorderColor="#666666" AutoPostBackOnFilter="false"
                                            FilterImageUrl="../Images/Telerik/Filter.gif">
                                            <HeaderStyle HorizontalAlign="left" Width="18%"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="left" Width="18%" CssClass="FontFamily"></ItemStyle>
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="Abbr" HeaderText="Abbreviation" SortExpression="Abbr"
                                            UniqueName="Abbr" Visible="True" ItemStyle-BorderWidth="1px" HeaderStyle-BorderWidth="1px"
                                            HeaderStyle-BorderColor="#666666" AutoPostBackOnFilter="false"
                                            FilterImageUrl="../Images/Telerik/Filter.gif">
                                            <HeaderStyle HorizontalAlign="Left" Width="29%"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Center" Width="29%" CssClass="FontFamily"></ItemStyle>
                                        </telerik:GridBoundColumn>
                                        <telerik:GridNumericColumn DataField="Person" HeaderText="Person" SortExpression="Person"
                                            UniqueName="Person" Visible="True" FilterImageUrl="../Images/Telerik/Filter.gif"
                                            DataType="System.Int32" ItemStyle-BorderWidth="1px"
                                            AutoPostBackOnFilter="false"
                                            HeaderStyle-BorderWidth="1px" HeaderStyle-BorderColor="#666666">
                                            <HeaderStyle HorizontalAlign="Center" Width="18%"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Center" Width="18%" CssClass="FontFamily" />
                                        </telerik:GridNumericColumn>
                                        <telerik:GridTemplateColumn AllowFiltering="false" HeaderText="Active" ItemStyle-BorderWidth="1px"
                                            HeaderStyle-BorderWidth="1px" HeaderStyle-BorderColor="#666666">
                                            <ItemTemplate>
                                                <asp:ImageButton runat="Server" ID="imgActive" Tag='<%# Eval("IsActive") %>' ImageUrl='<%# GetImage(Eval("IsActive").ToString()) %>'
                                                    CommandName="Active" ToolTip='<%# GetToolTip(Eval("IsActive").ToString()) %>' />
                                            </ItemTemplate>
                                            <ItemStyle Width="17%" HorizontalAlign="Center" />
                                            <HeaderStyle Width="17%" HorizontalAlign="Left" />
                                        </telerik:GridTemplateColumn>
                                    </Columns>
                                </MasterTableView>
                            </telerik:RadGrid>


Galin
Telerik team
 answered on 24 Oct 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?