Excel-like RadGrid

Thread is closed for posting
58 posts, 1 answers
  1. 31D92759-4BC3-4D2C-AE7D-B31839B88E77
    31D92759-4BC3-4D2C-AE7D-B31839B88E77 avatar
    7 posts
    Member since:
    Oct 2009

    Posted 07 Dec 2009 Link to this post

    How do I execute the project? Is this control or stand-alone page that I can view the sample?
  2. 23C72464-8FC9-43C3-9A12-B431B37B7758
    23C72464-8FC9-43C3-9A12-B431B37B7758 avatar
    11 posts
    Member since:
    Dec 2013

    Posted 09 Dec 2009 Link to this post

    Hello yoomee,

     You can use the latest sample in this message. You can download it, and run it locally. It contains all required resources. You can replace the .dll with the latest available one, or alter the logic further, to meet any custom requirements which you may have.


    Best wishes,
    Yavor
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. 435B3114-7FFC-40B5-82A9-3525345BB25D
    435B3114-7FFC-40B5-82A9-3525345BB25D avatar
    2 posts
    Member since:
    Oct 2009

    Posted 14 Jan 2010 Link to this post


    I executed the updated version and it worked perfectly as I expected, but when I try to switch to design mode, I run into this error:

     system.InvalidCastException: Unable to cast object of type 'Telerik.Web.UI.RadGrid' to Type 'Telerik.Wweb.UI.RadGrid'. at Telerik.Web.Design.RadGridDesigner.get_Grid() at Telerik.Web.Design.RadGridDesigner.GetDesignTimeHtml (DesignerRegionCollection regions) at System.Web.UI.Design.ControlDesigner.GetViewRendering(ConrolDesigner designer)

    Any ideas?

    Thanks.
  4. 435B3114-7FFC-40B5-82A9-3525345BB25D
    435B3114-7FFC-40B5-82A9-3525345BB25D avatar
    2 posts
    Member since:
    Oct 2009

    Posted 14 Jan 2010 Link to this post


    Never mind.  I recompiled and the error is gone. 
  5. CB05562A-82C1-409C-BFF2-3B16362E66E2
    CB05562A-82C1-409C-BFF2-3B16362E66E2 avatar
    26 posts
    Member since:
    Jan 2010

    Posted 15 Apr 2010 Link to this post

     

     

    hi,

    foreach
    (GridDataItem dataItem in RadGrid3.MasterTableView.Items)

     

    {

     

     

     

    TextBox MetadataId = (TextBox)dataItem["MetadataId"].Controls[0];


    can you please tell me what this line is doing.
     i m reciving an error on this line index out of bound please tell me the solution


    Samee javiad    

     

  6. CB05562A-82C1-409C-BFF2-3B16362E66E2
    CB05562A-82C1-409C-BFF2-3B16362E66E2 avatar
    26 posts
    Member since:
    Jan 2010

    Posted 16 Apr 2010 Link to this post

    hi,
    Can you please explain the code below.

    if

     

     

    (dataItem.ItemIndex == 0)

     

    {

    MetadataId.Attributes.Add(

     

    "onkeydown", "setFocus('" + "noControl" + "','" + (RadGrid3.MasterTableView.Items[dataItem.ItemIndex + 1]["MetadataId"].FindControl("MetadataId") as TextBox).ClientID + "','" + "noControl" + "','" + (RadGrid3.MasterTableView.Items[dataItem.ItemIndex]["keyWord"].FindControl("KeyWord") as TextBox).ClientID + "');");

     

    keyWord.Attributes.Add(

     

    "onkeydown", "setFocus('" + "noControl" + "','" + (RadGrid3.MasterTableView.Items[dataItem.ItemIndex + 1]["KeyWord"].FindControl("KeyWord") as TextBox).ClientID + "','" + (RadGrid3.MasterTableView.Items[dataItem.ItemIndex]["MetadataId"].FindControl("MetadataId") as TextBox).ClientID + "','" + (RadGrid3.MasterTableView.Items[dataItem.ItemIndex]["keyWord"].FindControl("KwyWord") as TextBox).ClientID + "');");

     

    value.Attributes.Add(

     

    "onkeydown", "setFocus('" + "noControl" + "','" + (RadGrid3.MasterTableView.Items[dataItem.ItemIndex + 1]["Value"].FindControl("Value") as TextBox).ClientID + "','" + (RadGrid3.MasterTableView.Items[dataItem.ItemIndex]["keyWord"].FindControl("KeyWord") as TextBox).ClientID + "','" + "noControl" + "');");

     

    }

     

     

    else if (dataItem.ItemIndex > 0 && dataItem.ItemIndex < RadGrid3.MasterTableView.Items.Count - 1)

     

    {

    MetadataId.Attributes.Add(

     

    "onkeydown", "setFocus('" + (RadGrid3.MasterTableView.Items[dataItem.ItemIndex - 1]["MetadataId"].Controls[0] as TextBox).ClientID + "','" + (RadGrid3.MasterTableView.Items[dataItem.ItemIndex + 1]["MetadataId"].Controls[0] as TextBox).ClientID + "','" + "noControl" + "','" + (RadGrid3.MasterTableView.Items[dataItem.ItemIndex]["KeyWord"].Controls[0] as TextBox).ClientID + "');");

     

    keyWord.Attributes.Add(

     

    "onkeydown", "setFocus('" + (RadGrid3.MasterTableView.Items[dataItem.ItemIndex - 1]["KeyWord"].Controls[0] as TextBox).ClientID + "','" + (RadGrid3.MasterTableView.Items[dataItem.ItemIndex + 1]["KeyWord"].Controls[0] as TextBox).ClientID + "','" + (RadGrid3.MasterTableView.Items[dataItem.ItemIndex]["MetadataId"].Controls[0] as TextBox).ClientID + "','" + (RadGrid3.MasterTableView.Items[dataItem.ItemIndex]["Value"].Controls[0] as TextBox).ClientID + "');");

     

    value.Attributes.Add(

     

    "onkeydown", "setFocus('" + (RadGrid3.MasterTableView.Items[dataItem.ItemIndex - 1]["Value"].Controls[0] as TextBox).ClientID + "','" + (RadGrid3.MasterTableView.Items[dataItem.ItemIndex + 1]["Value"].Controls[0] as TextBox).ClientID + "','" + (RadGrid3.MasterTableView.Items[dataItem.ItemIndex]["KeyWord"].Controls[0] as TextBox).ClientID + "','" + "noControl" + "');");

     

    }

     

     

    else if (dataItem.ItemIndex == RadGrid3.MasterTableView.Items.Count - 1)

     

    {

    MetadataId.Attributes.Add(

     

    "onkeydown", "setFocus('" + (RadGrid3.MasterTableView.Items[dataItem.ItemIndex - 1]["MetadataId"].Controls[0] as TextBox).ClientID + "','" + "noControl" + "','" + "noControl" + "','" + (RadGrid3.MasterTableView.Items[dataItem.ItemIndex]["KeyWord"].Controls[0] as TextBox).ClientID + "');");

     

    keyWord.Attributes.Add(

     

    "onkeydown", "setFocus('" + (RadGrid3.MasterTableView.Items[dataItem.ItemIndex - 1]["KeyWord"].Controls[0] as TextBox).ClientID + "','" + "noControl" + "','" + (RadGrid3.MasterTableView.Items[dataItem.ItemIndex]["MetadataId"].Controls[0] as TextBox).ClientID + "','" + (RadGrid3.MasterTableView.Items[dataItem.ItemIndex]["Value "].Controls[0] as TextBox).ClientID + "');");

     

    value.Attributes.Add(

     

    "onkeydown", "setFocusOrAddRecord('" + (RadGrid3.MasterTableView.Items[dataItem.ItemIndex - 1]["Value"].Controls[0] as TextBox).ClientID + "','" + "noControl" + "','" + (RadGrid3.MasterTableView.Items[dataItem.ItemIndex]["KeyWord"].Controls[0] as TextBox).ClientID + "','" + "noControl" + "');");

     

    }

    i copied this code from the sample project you attached also tell me is this project is done with latest Telerik tools?

    reply me ASAP

    Samee Javaid    

  7. 8300C70A-CB4B-404C-ABEA-2A727C2CDF57
    8300C70A-CB4B-404C-ABEA-2A727C2CDF57 avatar
    1566 posts
    Member since:
    Apr 2022

    Posted 19 Apr 2010 Link to this post

    Hello Samee,

    Thank you for contacting us.

    The posted code in your first post gets all TextBox controls from all cells in the column with unique name MetadataId.
    The code from your last post attaches the client side event handlers to the onkeydown event on all TextBox controls in each cell on the RadGrid's rows. Also it checks if the DataItem is a first, last or some of a middle rows. Depending on which row is represented by the DataItem, to the client functions setFocus and setFocusOrAddRecord are passed "noControl" string as a first, second, third or fourth parameter.

    Also the code in your last post, is from example which is done with RadControls for ASP.NET AJAX version Q2 2009.

    Additionally it will be helpful if you could send us a simple project that could be used for reproducing the exception described in your first post. Thus we will be able to gather more details about your scenario and provide you with more to-the-point answer.
    Also I suggest you to use the updated version of the Excel-Like RadGrid (excellikegrid-updated.zip). It is the updated version of the previous examples and has more features added in it.

    Looking forward for your reply.

    Regards,
    Radoslav
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  8. CB05562A-82C1-409C-BFF2-3B16362E66E2
    CB05562A-82C1-409C-BFF2-3B16362E66E2 avatar
    26 posts
    Member since:
    Jan 2010

    Posted 19 Apr 2010 Link to this post

    hi,
    thanks for the reply.
    kindly review my code and tell me where i am wrong,


     

     

    <radG:RadGrid ID="RadGrid1" runat="server" AllowCustomPaging="True"

     

     

     

    AllowFilteringByColumn="True" AllowMultiRowEdit="True"

     

     

     

    AllowMultiRowSelection="True" AllowPaging="True" AllowSorting="True"

     

     

     

    CellPadding="2" CellSpacing="2" DataSourceID="SqlDataSource1" EnableAJAX="True"

     

     

     

    GridLines="None" Height="100px" OnItemCommand="RadGrid1_ItemCommand"

     

     

     

    OnItemCreated="RadGrid1_ItemCreated" OnNeedDataSource="RadGrid_NeedDataSource"

     

     

     

    PageSize="40" Skin="Vista" VirtualItemCount="65536" Width="100%"

     

     

     

    AutoGenerateColumns="False">

     

     

     

    <mastertableview cellpadding="2" cellspacing="2"

     

     

     

    commanditemdisplay="Top" datakeynames="MetadataId" Height="200px"

     

     

     

    datasourceid="SqlDataSource1" editmode="InPlace">

     

     

     

    <filteritemstyle backcolor="#EFEBDE" />

     

     

     

    <commanditemtemplate>

     

     

     

    <asp:LinkButton ID="LinkButton1" runat="server"

     

     

     

    CommandName="UpdateEdited" Text="UpdateChanges"></asp:LinkButton>

     

     

     

    </commanditemtemplate>

     

     

     

    <rowindicatorcolumn>

     

     

     

    <HeaderStyle Width="20px" />

     

     

     

    </rowindicatorcolumn>

     

     

     

    <expandcollapsecolumn resizable="False" visible="False">

     

     

     

    <HeaderStyle Width="20px" />

     

     

     

    </expandcollapsecolumn>

     

     

     

    <Columns>

     

     

     

    <radG:GridBoundColumn DataField="MetadataId" DataType="System.Guid"

     

     

     

    HeaderText="MetadataId" ReadOnly="True" SortExpression="MetadataId"

     

     

     

    UniqueName="MetadataId">

     

     

     

    </radG:GridBoundColumn>

     

     

     

    <radG:GridBoundColumn DataField="KeyWord" HeaderText="KeyWord"

     

     

     

    SortExpression="KeyWord" UniqueName="KeyWord">

     

     

     

    </radG:GridBoundColumn>

     

     

     

    <radG:GridBoundColumn DataField="Value" HeaderText="Value"

     

     

     

    SortExpression="Value" UniqueName="Value">

     

     

     

    </radG:GridBoundColumn>

     

     

     

    <radG:GridBoundColumn DataField="Sheet" HeaderText="Sheet"

     

     

     

    SortExpression="Sheet" UniqueName="Sheet">

     

     

     

    </radG:GridBoundColumn>

     

     

     

    <radG:GridBoundColumn DataField="Row" HeaderText="Row" SortExpression="Row"

     

     

     

    UniqueName="Row">

     

     

     

    </radG:GridBoundColumn>

     

     

     

    <radG:GridBoundColumn DataField="Column" HeaderText="Column"

     

     

     

    SortExpression="Column" UniqueName="Column">

     

     

     

    </radG:GridBoundColumn>

     

     

     

    <radG:GridBoundColumn DataField="ColumnDataType" HeaderText="ColumnDataType"

     

     

     

    SortExpression="ColumnDataType" UniqueName="ColumnDataType">

     

     

     

    </radG:GridBoundColumn>

     

     

     

    <radG:GridBoundColumn DataField="MetaDataType" HeaderText="MetaDataType"

     

     

     

    SortExpression="MetaDataType" UniqueName="MetaDataType">

     

     

     

    </radG:GridBoundColumn>

     

     

     

    </Columns>

     

     

     

    <EditItemStyle BackColor="transparent" />

     

     

     

    <filteritemstyle backcolor="#EFEBDE" />

     

     

     

    </mastertableview>

     

     

     

    <exportsettings>

     

     

     

    <pdf pagebottommargin="" pagefootermargin="" pageheadermargin=""

     

     

     

    pageheight="11in" pageleftmargin="" pagerightmargin="" pagetopmargin=""

     

     

     

    pagewidth="8.5in" />

     

     

     

    </exportsettings>

     

     

     

    <clientsettings>

     

     

     

    <resizing allowcolumnresize="true" allowrowresize="true" />

     

     

     

    <scrolling allowscroll="true" enableajaxscrollpaging="true"

     

     

     

    usestaticheaders="true" />

     

     

     

    <scrolling allowscroll="True" enableajaxscrollpaging="True"

     

     

     

    usestaticheaders="True" />

     

     

     

    <resizing allowcolumnresize="True" allowrowresize="True" />

     

     

     

    </clientsettings>

     

     

     

    <HeaderStyle Width="150px" />

     

     

     

    </radG:RadGrid>

    here is code behind


     

     

     

    protected void RadGrid_NeedDataSource(object source, GridItemEventArgs e)

     

    {

     

     

    int startRowIndex = RadGrid1.CurrentPageIndex * RadGrid1.PageSize;

     

     

     

    int maximumRows = RadGrid1.PageSize;

     

     

     

    int maxColumns = 15;

     

     

     

    DataTable table = new DataTable();

     

     

     

    for (int i = 0; i < maxColumns; i++)

     

    {

    table.Columns.Add(

     

    new DataColumn("Column" + i));

     

    }

     

     

    for (int i = 0; i < maximumRows; i++)

     

    {

     

     

    int index = i + startRowIndex;

     

     

     

    object[] data = new object[maxColumns];

     

     

     

    for (int j = 0; j < maxColumns; j++)

     

    {

    data[j] =

     

    "";

     

    }

    table.Rows.Add(data);

    }

    ((

     

    RadGrid)source).DataSource = table;

     

    }


     

    protected

     

     

    void RadGrid1_ItemCommand(object source, Telerik.WebControls.GridCommandEventArgs e)

     

    {

     

     

    if (e.CommandName == RadGrid.UpdateEditedCommandName)

     

    {

     

     

    //include custom code to update database here

     

    }

    }

     

     

    protected void radtabstrip1_tabclick(object sender, Telerik.Web.UI.RadTabStripEventArgs e)

     

    {

     

     

    if (RadTabStrip1.Tabs[RadTabStrip1.Tabs.Count-1].Selected)

     

    {

     

     

    string sheetname = "sheet" +(RadTabStrip1.Tabs.Count);

     

    Telerik.Web.UI.

     

    RadTab rabtab = new Telerik.Web.UI.RadTab(sheetname);

     

    Telerik.Web.UI.

     

    RadTab rabtabadd = new Telerik.Web.UI.RadTab("+");

     

    RadTabStrip1.Tabs.RemoveAt(RadTabStrip1.Tabs.Count-1);

    RadTabStrip1.Tabs.Add(rabtab);

     

     

    //telerik.web.ui.radpageview radpageview = new telerik.web.ui.radpageview();

     

     

     

    //radpageview.controls.add(radgrid1);

     

     

     

    //radmultipage1.pageviews.add(radpageview);

     

    RadTabStrip1.Tabs.Add(rabtabadd);

    }

    }

    The code is working fine but its not displaying the rows although record is populated in grid.

    I have attached an image of how the grid is being displayed.

    thanks

    Samee Javaid

  9. 35FC6F20-EEB5-48C4-B91B-06C770662FC5
    35FC6F20-EEB5-48C4-B91B-06C770662FC5 avatar
    3388 posts
    Member since:
    Apr 2016

    Posted 19 Apr 2010 Link to this post

    Hi Samee,

    Try removing the Height property you have set to the RadGrid and see if it makes any difference.

    If the problem persists, please open a formal support ticket and send us a sample project illustrating the faced problems there.

    Kind regards,
    Iana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  10. 4A966324-927A-40FF-A840-F72AF168B198
    4A966324-927A-40FF-A840-F72AF168B198 avatar
    37 posts
    Member since:
    Aug 2006

    Posted 21 Apr 2010 Link to this post

    Hello,

    When i got the 178616_excellikegrid-updated.zip package and tried to run the solution i'm getting the following error when i hit Save in Database, any hints?

    ExecuteScalar requires an open and available Connection. The connection's current state is closed.
  11. CB05562A-82C1-409C-BFF2-3B16362E66E2
    CB05562A-82C1-409C-BFF2-3B16362E66E2 avatar
    26 posts
    Member since:
    Jan 2010

    Posted 22 Apr 2010 Link to this post

    hi...

    I am using TabStrip and Generating the Tabstrips and Girdviews on run time.I have done all the work but the gridview that is being generated on run time is not editing the cells it is showing Add new Record option in header instead of update Changes. Kindly tell me any Solution. and also see the code below.


     

     

    protected void RadMultiPage1_PageViewCreated(object sender, RadMultiPageEventArgs e)

     

    {

     

     

    //if (RadTabStrip1.SelectedTab != null)

     

     

     

    // if (!RadTabStrip1.SelectedTab.Text.Equals("+"))

     

     

     

    // {

     

     

     

    // countplus = true;

     

     

     

    // return;

     

     

     

     

    // }

     

    Telerik.WebControls.

     

    RadGrid radGrid = new Telerik.WebControls.RadGrid();

     

    radGrid.ID = controlName =

     

    "radGrid3"; //+ (Session["count"]).ToString();

     

    radGrid.VirtualItemCount = 65536;

    radGrid.PageSize = 40;

    radGrid.AllowPaging =

     

    true;

     

    radGrid.AllowSorting =

     

    true;

     

    radGrid.AllowMultiRowEdit =

     

    true;

     

    radGrid.AllowMultiRowSelection =

     

    true;

     

    radGrid.Skin =

     

    "Vista";

     

    radGrid.GridLines =

     

    GridLines.Both;

     

    radGrid.EnableAJAX =

     

    true;

     

    radGrid.AutoGenerateColumns =

     

    true;

     

    radGrid.ExportSettings.Pdf.PageHeight = 11;

    radGrid.ExportSettings.Pdf.PageWidth = 8;

    radGrid.ClientSettings.Scrolling.AllowScroll =

     

    true;

     

    radGrid.ClientSettings.Scrolling.EnableAJAXScrollPaging =

     

    true;

     

    radGrid.ClientSettings.Scrolling.UseStaticHeaders =

     

    true;

     

    radGrid.MasterTableView.CellPadding = 0;

    radGrid.MasterTableView.CellSpacing = 0;

    radGrid.MasterTableView.CommandItemDisplay = Telerik.WebControls.

     

    GridCommandItemDisplay.Top;

     

    radGrid.MasterTableView.EditMode = Telerik.WebControls.

     

    GridEditMode.InPlace;

     

    radGrid.MasterTableView.RowIndicatorColumn.HeaderStyle.Width = 20;

    radGrid.MasterTableView.ExpandCollapseColumn.Resizable =

     

    false;

     

    radGrid.MasterTableView.ExpandCollapseColumn.Visible =

     

    false;

     

    radGrid.MasterTableView.ExpandCollapseColumn.HeaderStyle.Width = 20;

    radGrid.MasterTableView.EditItemStyle.BackColor = System.Drawing.

     

    Color.Transparent;

     

    radGrid.MasterTableView.FilterItemStyle.BackColor = System.Drawing.

     

    Color.RosyBrown;

     

     

     

     

    //radGrid.MasterTableView.CommandItemTemplate = System.Web.UI.ITemplate.;

     

     

     

    radGrid.AllowPaging =

     

    true;

     

    radGrid.ItemCreated +=

     

    new Telerik.WebControls.GridItemEventHandler(RadGrid1_ItemCreated);

     

    radGrid.NeedDataSource +=

     

    new Telerik.WebControls.GridNeedDataSourceEventHandler(RadGrid_NeedDataSource);

     

     

    e.PageView.Controls.Add(radGrid);

    Session[

     

    "count"] = (int) Session["count"] + 1;

     

    }

     

    protected

     

     

    void Page_Load(object sender, EventArgs e)

     

    {

     

     

     

    Telerik.WebControls.

     

    RadGrid radGrid = new Telerik.WebControls.RadGrid();

     

     

     

    if (controlName != null)

     

    {

    radGrid.ID = controlName;

     

    for (int i = 0; i < radGrid.PageSize; i++)

     

    {

    radGrid.EditIndexes.Add(i);

    }

    }
    }

  12. 8300C70A-CB4B-404C-ABEA-2A727C2CDF57
    8300C70A-CB4B-404C-ABEA-2A727C2CDF57 avatar
    1566 posts
    Member since:
    Apr 2022

    Posted 23 Apr 2010 Link to this post

    Hi,

    @Michel Hayek
    Please check out the following articles, which explain the described exception:
    http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/d8623a47-1373-48f9-807e-bc00fdcc83f0
    http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_22886044.html
    http://www.dbforums.com/microsoft-sql-server/1616415-executescalar.html
    http://www.velocityreviews.com/forums/t123119-trouble-opening-a-connection-to-sql-2000-db.html

    @ Samee Mir
    I have reviewed the source code which you post. However it is not runnable and I could not reproduce the described issue. Could you please please open a formal support ticket and send us a runnable project (including the database files) which we could debug locally. Thus we will be able to gather more details about your scenario and provide you with more to-the-point answer.

    Regards,
    Radoslav
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  13. B6DDCBC8-8A33-475B-A0FE-CB8320C1B315
    B6DDCBC8-8A33-475B-A0FE-CB8320C1B315 avatar
    9 posts
    Member since:
    Apr 2010

    Posted 04 May 2010 Link to this post

    I executed the updated version and it worked perfectly as I expected, but i was not able to group by any column.
    It updated the old Grid to the new Q1 2010 SP1 version.
    Any idea how to get it work?
  14. 8300C70A-CB4B-404C-ABEA-2A727C2CDF57
    8300C70A-CB4B-404C-ABEA-2A727C2CDF57 avatar
    1566 posts
    Member since:
    Apr 2022

    Posted 05 May 2010 Link to this post

    Hi Markus,

    You could try setting the GridTableView.GroupByExpressions property, however the updated version of the Excel-Like RadGrid has a lot of custom JavaScript code and grouping by any column will cause some functionality to stop working. For example Up, Down navigation with arrow keys will not work as expected. In order to achieve the desired functionality concerning grouping you need to write some custom code to modify the logic of the example.

    All the best,
    Radoslav
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  15. 906B38F5-22FF-4A22-9FC0-3DB83009799C
    906B38F5-22FF-4A22-9FC0-3DB83009799C avatar
    3 posts
    Member since:
    Jan 2010

    Posted 08 May 2010 Link to this post

    Greetings,

    This is a most excellent thread and I thank the Telerik team in advance for the time taken to polish this application as time goes by.  This dedication to support is one of the main reasons Telerik gets my full support. 

    I like the RadGrid, but I don't love it yet.  I have spent a considerable amount of time with it in the past few months (on test projects), but there are many annoying traits that persist.  The trouble starts with my background which is win-forms applications.  Migrating to web forms forces me to reconsider certain issues.  Hierarchical grids have been pretty much the bread and butter of my applications, and one of the major reasons I chose Telerik.  It does a great job in this regard.  However, when it comes to editing, the constant repainting of the web form becomes a major issue.  That page flicker is annoying every time I go back and forth from edit mode.  It creates a lousy user interface experience.  I have tried to implement Ajax to get rid of this annoying flicker but to no avail. I can optimize the response (by the way, thanks for three optimizing video seminars) but it is still not the look and feel that I am after.  I have even considered learning MVC (your MVC behavior is very similar to what I want to achieve), but threads like this one tell me that I might just make Web forms work. 

    I am willing to forgo hierarchical grids to achieve what I am after (could even go as far as one order - one item rule if it speed up data entry).

    An Excel Like behavior is what I am after, but with lots more functionality.   I would like the user to navigate from one cell to another, change the value, then continue to a different cell and repeat the behavior without having to go back and forth from edit mode. Have the changes made checked to some server defined business criteria and saved automatically (i.e. once the user selects a different row or different cell for example - like validation on a win form control)  Maybe changes made to one cell would affect a different cell and it would be nice to have this value updated without repainting the whole page.   I have gone through both this example (excel like grid) and client batch updates http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/clienteditbatchupdates/defaultcs.aspx
    Basically I would be recreating a similar behavior as to a win-form grid.  I have no idea how to do it (without the constant repainting) using the Asp.Net RadGrid (or MVC extensions for that matter).

    Other issues that I would like to see addressed in the example that you have placed for our use in this thread is the use of DropDownLists, NumericOnly, DateTimeSelectors, CheckBoxes and, very important ReadOnly behavior to some selected cells.  ClientEditBatchUpdates has the DropDown lists and also I could work with the names of the controls to implement the ReadOnly behavior.

    It's very cool to download your Excel example and have it running in seconds and say "yes, this is what I am after", only to later find out that there are real-life limitations to how far this example can be taken.  On the first RadGrid optimization video http://tv.telerik.com/aspnet/radgrid/optimizing-radgrid-aspnet-ajax you have a great real life example that addresses the issues I am mentioning here, but, for the life of me can't find a download of that example; so, I know it can be achieved with your grid, but it would be real cool if I could see how you achieved it.

    I can probably work out (actually that's what I am doing now) through lots of trial and error, what can and cannot be done with the Telerik grid.  Your extensive library goes a long way to resolving many of the issues, but with the release of Visual Studio 2010, LinqQ, ASP.NET 4.0 I don't know if I am doing things the old obsolete way or if there are easier ways to do it now.  Take for example Linq vs SQL.  It's not that I can't follow the UpdateDatabase() routine to save changes (I've been doing it this way for years); but, can't I bind the data to a LinqDataSource and save myself so much code writing?  In the Batch-Client edit example you actually bind the controls to a SQLDataSource, in this example you don't.  With SQLDataSource I must pass the UpdateParameters; couldn't I avoid this issue with Linq?  Isn't the reason for the Linq technology precisely this, to avoid all this code writing?  What kind of conflicts do I get when I start mixing Linq and javascript?

    I would like to see an Excel Like Grid for Web Forms tutorial with the following traits (let's not worry about hierarchical for now):
    1) Create the DataGrid like one normally does (of course with the modifications you tell me to add); that is selecting tooltips, header texts, columnd width, filtering behavior for all columns.  In other words, stay away from AutoGenerateColumns.
    2) For those columns that are going to be in constant Excel-Like edit behavior (i.e. not readonly), be able to select the type of entry behavior expected (Text, Numeric (of specific type), checkbox, dropdownlist, datetime).  How would I create them in the Grid during this design time since it's a mixed grid (ReadOnly labels, custom edit controls)?
    3) Implement the common datetime selector for all cells (as recommended in the optimizing video).
    4a) Have a way to validate the data typed in according to business rules after cell exit (including the possibility of changing the value of a separate read-only cell on the same row).
    4b) If 4a cannot be done, then (since now I am using LinQ) I would have LinQ run the validation before updating then repainting the new values (modified to reflect rules if need be) on the row.  This would happen after I leave the row (see 5).
    5) Automatically save changes when I select a different row (or when I press save linkbutton on the command item template).
    6) Have all of this happen without repainting the page.
    7) If possible continue to be able to use Group (together with group footer calculations), Page, Sort, Filter.

    Now, I ask the question; can I do this with ASP.Net RadGrid?  How?  What are the issues that limit this behavior that I am obviously unaware of.  If it cannot be done with ASP.Net RadGrid, can it be done with MVC Telerik extensions? How?  (I would have to learn MVC and Microsoft's tutorials claim that, because of my non-web background I would be more comfortable with webforms; learning new tricks is not an issue -- learning the right ones is)

    Thanks in advance for your guidance concerning these issues.  If they have been addressed elsewhere, I would appreciate the links in a reply so that I may plow through them.  If I can persuade you into writing a test project that covers all these issues and submitting it here, then let me know where to send a keg of beer or a case of wine.

    Carlos

  16. 35FC6F20-EEB5-48C4-B91B-06C770662FC5
    35FC6F20-EEB5-48C4-B91B-06C770662FC5 avatar
    3388 posts
    Member since:
    Apr 2016

    Posted 11 May 2010 Link to this post

    Hello Carlos,

    Thank you for your feedback. We will consider improving the demo respectively.

    However if you want to achieve win-forms behavior in a web application I would suggest you to try RadControls for Silverlight.

    Other than this, you can open a formal support ticket and send us a sample project illustrating your scenario and the faced problems. We will debug it locally and turn back to you with our findings.

    Best wishes,
    Iana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  17. 906B38F5-22FF-4A22-9FC0-3DB83009799C
    906B38F5-22FF-4A22-9FC0-3DB83009799C avatar
    3 posts
    Member since:
    Jan 2010

    Posted 11 May 2010 Link to this post

    Thanks,

    Didn't know that Silverlight could do the Excel-like RadGrid, thanks, will check up on this.

    Couple of nice things I found out today (sure you can Google them and get them from telerik help, but this is info helpful to this post):

    1)  Changing the display values for Boolean from True False to whatever you need ("Disc." for True, "Av." for False in this example):
    <asp:Label ID="lblDiscontinued" runat="server"   
    Text='<%# Convert.ToBoolean(Eval("Discontinued")) ? "Disc." : "Av." %>' /> 
     

    2) Improving data entry type validation by changing parameters on the numericSetting object:

     

    txtBox = (TextBox)dataItem.FindControl("txtQty");   
    NumericTextBoxSetting numericSetting = (NumericTextBoxSetting)RadInputManager1.GetSettingByBehaviorID("NumberBehavior")   
     
    numericSetting.MinValue = 0;  
    numericSetting.DecimalDigits = 4;  
     
    numericSetting.TargetControls.Add(new TargetInput(txtBox.UniqueID, true));  

     

     

     

    Thanks for the offer on the support ticket.  I've used them before and will use them again in the future as you give us very precise help and useful tips; but would it be possible for you to at least explain why I cannot use a LinqDataSource and must use a SQLDataSource in this example? 

    I might have to create a support ticket, but would appreciate if these two problems are simple and can be answered readily: 
    1) On my demo, If I click on a header to sort, the grid disappears;
    2) I cannot seem to fire the RadAjaxManager1_AjaxRequest.  Placed alert messages before and after $find on ProcessChanges; the one before fires (and the proper Ids string is constructed), the one after $find does not (neither do the SetMessages on the page code, nor can I reach a breakpoint in debug mode).
    Verified line by line to see if I had anything different.  Took away AllowPaging on the RadGrid. Set EnableAjax=True on the RadAjaxManager.  Read this post, saw that another user had same problem, but not the solution.  Don't see how to solve this problem, ran out of ideas.

    Thanks

    Carlos

     

  18. 35FC6F20-EEB5-48C4-B91B-06C770662FC5
    35FC6F20-EEB5-48C4-B91B-06C770662FC5 avatar
    3388 posts
    Member since:
    Apr 2016

    Posted 14 May 2010 Link to this post

    Hello Carlos,

    Indeed, you can bind the grid to LinqDataSource and for more information on how to enable automatic CRUD operations with it, you can check this online demo.

    Regarding your last questions:
        1. Could you please specify on which is the attached demos you are replicating this error?
        2. You can find this article on how to get the client-side object instance of the RadAjaxManager. Pasting the RadAjaxManager declaration and the ProcessChanges method, might help us in finding the source of the issue in your case.

    Best wishes,
    Iana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  19. 906B38F5-22FF-4A22-9FC0-3DB83009799C
    906B38F5-22FF-4A22-9FC0-3DB83009799C avatar
    3 posts
    Member since:
    Jan 2010

    Posted 14 May 2010 Link to this post

    Hi Iana,

    Oops! (tell you why in a minute). 

    For the Excel Like Grid demo the zip file has 178616 as part of the name.  It's the one that gives the out-of-bound error (to which I added a check on Control.Count > 0 to bypass the error).   In the original downloaded demo, Grid Sort features are turned off.  If I turn Grid Sort, I do get the Grid to sort, however I lose the Excel-like behavior (which I get back if I Add a New record - so I guess I should add some code to return to edit mode after sort or something).  The point is Sort works, the demo works.

    Now to the OOPS part.

    I just realized that my pasts two posts are about this demo:
    http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/clienteditbatchupdates/defaultcs.aspx

    It replicates some of the real cool behavior you have in this Excel-Like Demo, but adds dropdown and checkboxes to the grid.  Also, I can have read-only behavior on some of the columns.  Unfortunately, it is in this demo (not the Excel) that I have trouble getting it to work as advertised (If I enable Ajax - saving works, but sorting does not; viceversa Ajaxrequest never gets fired so no saving, but sort works)

    I just realized this mistake, and I guess the reason was trying to build on the behavior of your Excel-Like model (which is what I am after), but with more RadGrid features that I cove for this project.

    I also realized why use a sqlDataSource or a LinqDatasource is a non-issue as we populate a DataSet for this Excel example.  In the other demo, we use the data stored in the sqlDataSource, but not as nice as with the DataSet and, unfortunately, do not take advantage of the linqDataSource power.

    Still, I used the bit of code you asked me to write out and this is what I get on the ProcessChanges Method:
    Initiated by: RadGrid1
    Updated Controls: RadGrid1 RadInputManager1 Label1
    Initiated by: RadAjaxManager1
    Updated Controls: RadGrid1 RadInputManager1 Label1

    I also set up a breakpoint at the end of RadAjaxManager1_AjaxRequest to see why the page would return a blank page (if I pressed Sort or save the screen would go blank -data saved but not the behavior I expected).  The breakpoint told me that the Grid is recreated, also Radgrid1 Item created followed by Item Templates on Grid and $find in cancelchanges and $find in Processchanges, but after that nothing, blank page.

    I guess the right way will be for me to open a support ticket, but after you suggested Silverlight, I am now in the process of learning about it this weekend and see if this will be a better path.

    Thanks for your help, Telerik does live up to its reputation in this matter.

    Carlos

  20. 35FC6F20-EEB5-48C4-B91B-06C770662FC5
    35FC6F20-EEB5-48C4-B91B-06C770662FC5 avatar
    3388 posts
    Member since:
    Apr 2016

    Posted 17 May 2010 Link to this post

    Hello Carlos,

    I followed the additional information provided, however I was not able to replicate the mentioned issues in the online demo for client edit with batch updates.
    Therefore it would be best to send us a runnable application of the problematic behavior if you decide using RadGrid for ASP.NET AJAX for your purpose.

    All the best,
    Iana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  21. 55235FC8-C455-4C43-8051-A189EE3318CC
    55235FC8-C455-4C43-8051-A189EE3318CC avatar
    5 posts
    Member since:
    Nov 2009

    Posted 17 May 2010 Link to this post

    I'm testing the excel-like radgrid project with the latest Web.UI version and I have a problem every time I move down passed row number 6 an error is thrown. I found that there is actually a condition in the Script.js (listed below) that checks for row #6 and parse it in a different way, leaving the cell with the wrong ID (null) and causing the error. Same thing happens moving to the right and passing column #10.

    Is there are any reasons for this conditions, am I missing something?
    Can you help me fixing this?

    // Parse the temporary ID's and assaign them to the variables.
    function SetIdParts() {
        var indexOfLastUnderscore = selectedCellId.lastIndexOf("_");
        var subStr = selectedCellId.substr(0, indexOfLastUnderscore);
        var indexOfLastLetter = subStr.lastIndexOf("l");
        var subStrTempI = selectedCellId.substr(indexOfLastLetter + 1, subStr.length - 1 - indexOfLastLetter);
        var subStrTempJ = selectedCellId.substr(indexOfLastUnderscore + 4, selectedCellId.length - 1 - indexOfLastUnderscore);

        // If the row is of the top 6 rows, the id starts with leading 0(zero) symbol.
        // Perform checks to avoid wrong results from parse() function.
        if (subStrTempI[0] == leadingZero) {
            tmpI = parseInt(subStrTempI.substr(1, subStrTempI.length - 1));
        }
        else {
            tmpI = parseInt(subStrTempI);
        }
        // If the column is of the first 10 columns, the id starts with leading 0(zero) symbol.
        // Perform checks to avoid wrong results from parse() function.
        if (subStrTempJ[0] == leadingZero) {
            tmpJ = parseInt(subStrTempJ.substr(1, subStrTempJ.length - 1));
        }
        else {
            tmpJ = parseInt(subStrTempJ);
        }

        firstPart = selectedCellId.substr(0, indexOfLastLetter + 1);
        secondPart = selectedCellId.substr(indexOfLastUnderscore, selectedCellId.length - indexOfLastUnderscore - 2);
    }
  22. 8300C70A-CB4B-404C-ABEA-2A727C2CDF57
    8300C70A-CB4B-404C-ABEA-2A727C2CDF57 avatar
    1566 posts
    Member since:
    Apr 2022

    Posted 18 May 2010 Link to this post

    Hi Rafael,
    The navigation between inputs depends on the calculating of their id's. For example if the current selected input's ID is RadGrid1_ctl00_ctl11_ctl02, the id of the right cell will be RadGrid1_ctl00_ctl11_ctl03, the id of the bottom cell will be RadGrid1_ctl00_ctl12_ctl02. So the hole RadGrid could be represent as a two dimensional matrix. If the user navigates to right the last two digit will be grown up with one(_ctl02, _ctl03, _ctl04, _ctl05 ...) (respectively index J). If the user navigates to down the middle digits will be grown up with one(  _ctl11_ctl02, _ctl12_ctl02, _ctl13_ctl02, _ctl14_ctl02 ...)  (respectively index I).  However if the current input belongs to the first six rows its ID will be with leading zero(RadGrid1_ctl00_ctl04_ctl01, RadGrid1_ctl00_ctl05_ctl01 ...). When you parse "09"(parseInt("09")), the javascript returns as a result 0 (zero).  So if the input is from the first six rows only the last digit have to be parsed.  
    Also you could check out the attached picture which shows the id's of the inputs into the excel like grid example.

    The problem which you are facing is only under IE7 and it is caused by getting the first char symbol from string (subStrTempI[0]). IE 7 does not support it and it return "unidentified". To achieve the desired functionality you could try replacing the subStrTempI[0] with subStrTempI.substring(0,1):
    // Parse the temporary ID's and assaign them to the variables.
    function SetIdParts() {
        var indexOfLastUnderscore = selectedCellId.lastIndexOf("_");
        var subStr = selectedCellId.substr(0, indexOfLastUnderscore);
        var indexOfLastLetter = subStr.lastIndexOf("l");
        var subStrTempI = selectedCellId.substr(indexOfLastLetter + 1, subStr.length - 1 - indexOfLastLetter);
        var subStrTempJ = selectedCellId.substr(indexOfLastUnderscore + 4, selectedCellId.length - 1 - indexOfLastUnderscore);
     
        // If the row is of the top 6 rows, the id starts with leading 0(zero) symbol.
        // Perform checks to avoid wrong results from parse() function.
        if (subStrTempI.substring(0,1) == leadingZero) {
            tmpI = parseInt(subStrTempI.substr(1, subStrTempI.length - 1));
        }
        else {
            tmpI = parseInt(subStrTempI);
        }
        // If the column is of the first 10 columns, the id starts with leading 0(zero) symbol.
        // Perform checks to avoid wrong results from parse() function.
        if (subStrTempJ.substring(0,1) == leadingZero) {
            tmpJ = parseInt(subStrTempJ.substr(1, subStrTempJ.length - 1));
        }
        else {
            tmpJ = parseInt(subStrTempJ);
        }
     
        firstPart = selectedCellId.substr(0, indexOfLastLetter + 1);
        secondPart = selectedCellId.substr(indexOfLastUnderscore, selectedCellId.length - indexOfLastUnderscore - 2);
    }

    Additionally I am sending you the modified version of the excel-like grid.

    If you need further assistance, do not hesitate to contact us again.

    Kind regards,
    Radoslav
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  23. 06C21262-2401-4E51-946A-CE572424DBC8
    06C21262-2401-4E51-946A-CE572424DBC8 avatar
    1 posts
    Member since:
    May 2010

    Posted 21 May 2010 Link to this post

    I find his control very useful and this is exactly the look and feel and behaviour i was looking for .
    I would like to know if the radgrid supports cell formulas like in an excel? If there is no inbuilt formula support, is there any way by which I can implement my functionality like changing a cell value based on some values in other cells.?
  24. 8300C70A-CB4B-404C-ABEA-2A727C2CDF57
    8300C70A-CB4B-404C-ABEA-2A727C2CDF57 avatar
    1566 posts
    Member since:
    Apr 2022

    Posted 25 May 2010 Link to this post

    Hi Neo,

    Currently the excel-like grid example does not support cell formulas like in an excel. However you could try implementing this functionality with some custom code. Please check out the following forums threads which elaborate on how to parse the formulas with JavaScript:
    http://www.jguru.com/faq/view.jsp?EID=480122
    http://stackoverflow.com/questions/28256/equation-expression-parser-with-precedence
    http://ewbi.blogs.com/develops/2004/12/excel_formula_p.html

    If you need further assistance, do not hesitate to contact us again.

    Best wishes,
    Radoslav
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  25. EFC2F730-197D-4527-A4FF-BB9D037990F3
    EFC2F730-197D-4527-A4FF-BB9D037990F3 avatar
    23 posts
    Member since:
    Jun 2010

    Posted 23 Aug 2010 Link to this post

    I am trying to add data validation to the Excel-Like Radgrid.  I am using a radinputmanager.  When I add the grid text boxes to the target controls for the inputmanager I no longer see the current values of the grid.

    How do I add data validation to this?  All Cells must be numeric only.

    public void InstantiateIn(Control container)
    {
        int n = rfdFieldData.ColumnNum;
        string CtlNum = n < 10 ? "0" + n.ToString() : n.ToString();
        txtText = new TextBox();
        txtText.ID = "ctl" + CtlNum;
        txtText.DataBinding += new EventHandler(txtText_DataBinding);
        container.Controls.Add(txtText);
        //RadGrid grid = container.Parent.Controls[0] as RadGrid;
        lblKey = new Label();
        lblKey.ID = "lbl" + CtlNum;
        lblKey.Visible = false;
        lblKey.DataBinding += new EventHandler(lblKey_DataBinding);
        container.Controls.Add(lblKey);
        RadInputManager rim = container.Parent.Parent.Parent.Parent.Parent.FindControl("RadInputManager1") as RadInputManager;
        NumericTextBoxSetting numericSetting = (NumericTextBoxSetting)rim.GetSettingByBehaviorID("NumericBehavior1");
        numericSetting.TargetControls.Add(new TargetInput(txtText.UniqueID, true));
    }
  26. 50B6A6EE-746B-4AEB-BD6E-48BD4B7AC427
    50B6A6EE-746B-4AEB-BD6E-48BD4B7AC427 avatar
    1124 posts
    Member since:
    Sep 2012

    Posted 25 Aug 2010 Link to this post

    Hello Dave,

    I tried to replicate the issue which you described, but to no avail.
    Attached to this message, you will find the code which I used for testing.

    Please, take a look at it and let me know if there are any differences at your end, which I may be leaving out.

    All the best,
    Mira
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  27. EFC2F730-197D-4527-A4FF-BB9D037990F3
    EFC2F730-197D-4527-A4FF-BB9D037990F3 avatar
    23 posts
    Member since:
    Jun 2010

    Posted 01 Sep 2010 Link to this post

    Is it possible to implement Copying from one Column and Pasting into another Column?
  28. 8300C70A-CB4B-404C-ABEA-2A727C2CDF57
    8300C70A-CB4B-404C-ABEA-2A727C2CDF57 avatar
    1566 posts
    Member since:
    Apr 2022

    Posted 03 Sep 2010 Link to this post

    Hello Dave,

    The excel-like grid implementation demonstrated here does not support the copy & paste functionality from one column to another. The example only demonstrates the basic functionality for showing cells and navigate between them like in MS excel. Also all functionalities is achieved by custom code and they have some limitations.

    Regards,
    Radoslav
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.