RADGrid Footer Total

4 posts, 0 answers
  1. Madhu
    Madhu avatar
    5 posts
    Member since:
    Jul 2008

    Posted 17 Sep 2008 Link to this post

    I have created Grid dynamically (Simply Grid is defined in .aspx file, columns are bind from code behind., no hard coded column Name) I have Combo Box outside the grid, gird loads with different column as item changes in Combo Box. 

    protected

    void grdSystemComponents_ItemCreated(object sender, GridItemEventArgs e){
    if

    (e.Item is GridDataItem && e.Item.IsInEditMode || e.Item is GridFilteringItem)
    {
    foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
    {
    if ((column is GridBoundColumn) && !((GridBoundColumn)column).ReadOnly)
    {
    TextBox textBox = null;
    if (e.Item is GridDataItem)
    {
    textBox = ((
    TextBox)((GridDataItem)e.Item)[column.UniqueName].Controls[0]);
    textBox.Style[
    "width"] = "90%";
    textBox.Style[
    "height"] = "11px";
    textBox.Style[
    "border"] = "0px";
    textBox.Style[
    "font-size"] = "11px";
    } }

    //Each column is assigned UniqueName as ID of respective Column
    string
    headerID = column.HeaderText;
    int count = dtHeaderInfo.Rows.Count;
    for (int i = 0; i < count; i++)
    {
    if (headerID == dtHeaderInfo.Rows[i][0].ToString())
    column.UniqueName = dtHeaderInfo.Rows[i][0].ToString();
    } } } }

    Here are my two Issues:

    1) Since Grid is set up this way, I have no idea how to calculate Footer Total for each columns. Number of column changes depending on the selected Item on Combo Box.

    2) I also need to update Caluculation as user will enter number on textboxes of the Grid. In the grid, there is a column called "Tot Num", as user enter numbers here I need to update other columns on same row, user can change it but can't exceed value of "Tot Num" column. If "Tot Number" is zero, should not allow to enter number.

    I need to have database interaction for calculation? How do I go go to accomplish this? Your help is much appreciated.

    thansk
    Madhu

  2. Cads
    Cads avatar
    3 posts
    Member since:
    Nov 2009

    Posted 09 Nov 2009 Link to this post

    Hi Madhu,

    Did Telerik or anyone else helped you with this issue? I'm coming across the same problem since my gridview is also bound server side. I'd like have the footer populate counts especially when the user drags any heading into grouping.
  3. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 13 Nov 2009 Link to this post

    Hello Madhu and Cads,

    You can handle the ColumnCreated event of RadGrid and there set the Aggregate property for each column as desired.
    And regarding the recalculations: After the user enters something in the TextBox in edit more and the changes are saved in the database after the Update buton is clicked, the totals will be automatically updated as well.
    I am attaching a sample project following your scenario. Check it out and let me know if it helps.

    Best wishes,
    Iana
    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.
  4. chitralekha
    chitralekha avatar
    1 posts
    Member since:
    Apr 2011

    Posted 16 Apr 2011 Link to this post

    hello
    I m doing a bulk entry project like excel, the coding used here is working fine when i've not hardcoded column in aspx file, but when i give the column name it is giving me ArgumentOutofRangeException in the following line :
    textBox = ((TextBox)((GridDataItem)e.Item)[column.UniqueName].Controls[0]);
    can u help me with this, I need to define column name.
Back to Top