Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
236 views

I have a row of totals in my grid. I add a custom footer to my grid where I add a grand total for 3 total columns to the last cell. I add a <br /> and &nbsp; to all the other cells as shown below.

if (e.Item is GridFooterItem)
        {
            GridFooterItem footerItem = (GridFooterItem)e.Item;
            {
                double a= 0;
                double b= 0;
                double c= 0;
                double sumA = 0;
                double sumB = 0;
                double sumC = 0;
                double total = 0;
 
                foreach (GridDataItem item in e.Item.OwnerTableView.Items)
                {
                    a= Double.Parse(item["A"].Text, NumberStyles.Currency);
                    sumA += a;
                    b= Double.Parse(item["B"].Text, NumberStyles.Currency);
                    sumB += b;
                    c= Double.Parse(item["C"].Text, NumberStyles.Currency);
                    sumC += c;
                }
 
                total = sumA + sumB + sumC;
 
                footerItem["A"].Text = sumA .ToString("c2") + "<br /> ";
                footerItem["B"].Text = sumB .ToString("c2") + "<br /> ";
                footerItem["C"].Text = sumC.ToString("c2") + "<br />" + total.ToString("c2");
            }

 

on my excel export the blank cell does not show. It seems excel is ignoring the line break and empty cell and just bottom aligning the total for me. See attached.

 

I even tried the approach in some other threads to replace the <br />  with &#10; but that just takes the new line away completely.

protected void grid_GridExporting(object sender, GridExportingArgs e)
    {
        RadGrid grid = (RadGrid)sender;       
        e.ExportOutput = e.ExportOutput.Replace("<br />", " ");
    }
Eyup
Telerik team
 answered on 14 Feb 2019
32 answers
1.1K+ views
Is there a Telerik control or does anyone know how to capture a signature in the web browser allowing the user to "draw" it and the submit/save it?  In C#?
Rumen
Telerik team
 answered on 14 Feb 2019
16 answers
507 views
I have a situation similar to this one. Basically, in the edit form I've got a dropdown list to which the user is able to use a popup to select a new value which triggers a postback so the value can be added to the popup and be selected in the popup. In the code-behind, I do
Dim editedItem As GridEditableItem = Nothing
If RadGrid1.MasterTableView.IsItemInserted Then
    editedItem = RadGrid1.MasterTableView.GetInsertItem()
End If
If IsNothing(editedItem) Then
    editedItem = RadGrid1.EditItems.Item(0)
End If
  
Dim ddl As DropDownList = CType(editedItem.FindControl("ddlId"), DropDownList)
ddl.Items.Insert(0, newValue)
ddl.SelectedValue = newValue
This works when I am adding a new item. However, if I am editing an existing item, the drop down list is not found; ddl is Nothing and I get a NullReferenceException.

In stepping through the code, in the add case, editedItem has a value of GridEditFormInsertItem with a type of GridEditableItem. However, in the edit case, its value is a GridDataItem with a type of GridEditableItem and its controls appear to be for the regular grid display rather than the edit form.

Any thoughts on how I can get this to work in the edit case?
Attila Antal
Telerik team
 answered on 13 Feb 2019
1 answer
190 views

I'm currently using R2 2018 SP1 and I'm experiencing a display issue with the grouping header. In my project, I have two grids that are very similar. Both use grouping but one one grid has static headers. 

When I use static headers, the grouping header show the column grid lines (i.e. row renders a <TD> for each column). But when I just simply remove theUseStaticHeaders="true" attribute, the grouping row is displayed as expected without the column grid lines (i.e. row renders with as one TD and a colspan attribute). Also note that I'm using the WebBlue theme.

See the attached screenshots displaying both situations.

I was unable to find this specific situation in the current grid demo so I was unable to confirm if this is a problem in the current release. 

Thanks

Loy.

 

Attila Antal
Telerik team
 answered on 13 Feb 2019
3 answers
1.0K+ views
How can I reset a RadTextBox to its configured EmptyMessage value using JavaScript?

Note, I want to use the property value without having to state it twice.

Thanks.
Rumen
Telerik team
 answered on 13 Feb 2019
5 answers
315 views
Hi,

We have users who are fond of uploading files named like this - 

CMSC_MANAGING SPEECH & SWALLOWING IN MS.PDF

The ampersand kills any ability to download the file and we get a Bad Request error. Is there any flag in the file explorer that would handle this scenario and encode the names and allow download without error? Thanks.
Vessy
Telerik team
 answered on 13 Feb 2019
3 answers
237 views
Hi

There is a radgrid in my aspx page and it contains an image button. I want to dynamically ajaxify the button. Can anyone help with an example?

Thanks
JC
Rumen
Telerik team
 answered on 13 Feb 2019
15 answers
388 views
How can i make the "DurationType" column in my code to a dropdown menu?

protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["GridData"] == null)
            {
                DataTable table = GetTable();
                Session.Add("GridData", table);
            }
            DefineGridStructure();
        }
// Code snipet to create the template in order to add the dropdown menu
public class MyTemplate : ITemplate
    {
        protected DropDownList dl;
        private string colname;

        public MyTemplate(string cName)
        {
            colname = cName;
        }

        public void InstantiateIn(System.Web.UI.Control container)
        {
            dl = new DropDownList();
            dl.ID = colname;
            dl.Items.Add(new ListItem("Hours", "Hours"));
            dl.Items.Add(new ListItem("Days", "Days"));
            dl.Items.Add(new ListItem("Weeks", "Weeks"));
            dl.Items.Add(new ListItem("Months", "Months"));
            container.Controls.Add(dl);
        }

        void LoadDefault_DataBinding(object sender, EventArgs e)
        {
            DropDownList dBox = (DropDownList)sender;
            GridDataItem container = (GridDataItem)dBox.NamingContainer;
        }

    } 
 




        private void DefineGridStructure()
        {
            RadGrid grid = new RadGrid();
            grid.ID = "RadGrid1";
            grid.NeedDataSource += new GridNeedDataSourceEventHandler(grid_NeedDataSource);
            grid.AutoGenerateEditColumn = true;
            grid.AutoGenerateDeleteColumn = true;
            grid.AllowAutomaticInserts = false;
            grid.Width = Unit.Percentage(100);
            grid.PageSize = 15;
            grid.AllowPaging = true;
            grid.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;
            grid.AutoGenerateColumns = false;
            grid.MasterTableView.Width = Unit.Percentage(100);
            grid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.TopAndBottom;
            grid.AllowAutomaticDeletes = false;
            grid.AllowAutomaticUpdates = false;
            grid.InsertCommand +=grid_InsertCommand;
            grid.MasterTableView.DataKeyNames = new string[] { "RowNumber" };
            GridBoundColumn boundColumn = new GridBoundColumn();
            boundColumn.DataField = "RowNumber";
            boundColumn.HeaderText = "RowNumber";
            boundColumn.ReadOnly = true;
            grid.MasterTableView.Columns.Add(boundColumn);
            boundColumn = new GridBoundColumn();
            boundColumn.DataField = "Size";
            boundColumn.HeaderText = "Size";
            grid.MasterTableView.Columns.Add(boundColumn);
            boundColumn = new GridBoundColumn();
            boundColumn.DataField = "Description";
            boundColumn.HeaderText = "Description";
            grid.MasterTableView.Columns.Add(boundColumn);
            boundColumn = new GridBoundColumn();
            boundColumn.DataField = "Quantity";
            boundColumn.HeaderText = "Quantity";
            grid.MasterTableView.Columns.Add(boundColumn);
            boundColumn = new GridBoundColumn();
            boundColumn.DataField = "Duration";
            boundColumn.HeaderText = "Duration";
            grid.MasterTableView.Columns.Add(boundColumn);

                // Added code snipet to create the drowpdown menu from an itemplate
                GridTemplateColumn objGridTemplateColumn = new GridTemplateColumn();
                objGridTemplateColumn.HeaderText = "DurationType";
                objGridTemplateColumn.UniqueName = "DurationType";
                objGridTemplateColumn.ItemTemplate = new MyTemplate("DurationType");
                grid.MasterTableView.Columns.Add(objGridTemplateColumn);           



            boundColumn = new GridBoundColumn();
            boundColumn.DataField = "Amount";
            boundColumn.HeaderText = "Amount";
            grid.MasterTableView.Columns.Add(boundColumn);
            PlaceHolder1.Controls.Add(grid);
        }
 
        private void grid_InsertCommand(object sender, GridCommandEventArgs e)
        {
            // Looking to loop through the form so i can insert the values into the datatable
        }
 
 
 
 
 
        void grid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            DataTable current = (DataTable)Session["GridData"];
            RadGrid grid = (RadGrid)sender;
            grid.DataSource = current;
 
        }
 
 
 
        static DataTable GetTable()
        {
            //
            // Here we create a DataTable with a few columns.
            //
            // Create Datatable to store all colums
            DataTable dt = new DataTable();
            DataRow dr = null;
            dt.Columns.Add(new DataColumn("RowNumber", typeof(string)));
            dt.Columns.Add(new DataColumn("Size", typeof(string)));
            dt.Columns.Add(new DataColumn("Description", typeof(string)));
            dt.Columns.Add(new DataColumn("Quantity", typeof(string)));
            dt.Columns.Add(new DataColumn("Unit", typeof(string)));
            dt.Columns.Add(new DataColumn("Duration", typeof(string)));
            dt.Columns.Add(new DataColumn("DurationType", typeof(string)));
            dt.Columns.Add(new DataColumn("Amount", typeof(string)));
            dr = dt.NewRow();
            dr["RowNumber"] = 1;
            dr["Size"] = string.Empty;
            dr["Description"] = string.Empty;
            dr["Quantity"] = string.Empty;
            dr["Unit"] = string.Empty;
            dr["Duration"] = string.Empty;
            dr["DurationType"] = string.Empty;
            dr["Amount"] = string.Empty;
            dt.Rows.Add(dr);
            return dt;
        }
Eyup
Telerik team
 answered on 13 Feb 2019
4 answers
126 views

My website is focused on the NFL and its most engaged fans. These people enjoy following the NFL Draft, which is the annual selection process that determines what pro football teams graduating college players will play for. Our audience is very opinionated on the Draft, and we give them the ability to put the players in their own sort order based on their own opinions.

You do not need an account to see what this looks like: http://football.powerhousegm.com/DraftRoom/BigBoard2.aspx?v=s

There are about 1,200 players in this list; 100 per page. Each player has a specific slot in the overall order ("Rank") and users can put them in broader tiers by assigning a "Grade" (if you look at the page, the pink "R1+/R1" is the highest Grade.) Click on the pink button to see how a user would change the Grade.

We've run into trouble with this process (which does not use Telerik controls... yet.) Changing a Grade should move the player into the range in the overall order where similarly Graded players sit. But, where specifically in that order? At the top of that group if the player is being downgraded, and at the bottom of the higher tier if the user is changing his Grade to a higher one? In short, it's a messy process that I haven't solved logically, and thus haven't solved technically.

Does anyone have a good idea how we could handle this that would provide the best user experience?

The idea I'm toying with right now is to have tabs across the top of the list for each possible Grade, and grabber handles or something to allow the user to drag/drop prospects up/down in the list on each particular tab... or up/down buttons to move them one slot at a time. The user could still change the Grade, which would move the player to another tab.

Thanks in advance for any ideas/guidance!

 

Chris Barry

Rosa66
Top achievements
Rank 1
 answered on 13 Feb 2019
6 answers
3.6K+ views

I'm having NO LUCK trying to get a RadGrid to auto size it's height … here is what I'm trying to achieve (which seems simple to me) within RadPageLayout row:

1.  Set Grid's min-height and max-height

2.  Have the Grid auto size based on content and staying within the confines of min-Height and max-Height

I've search for answers and see the question has come up very often but the solutions are incredibly worky and not reliable for a task that is very simple.  Is there an easy solution to this without having to write 100's of lines of code?

I buy Telerik products to avoid having to write all this code, so I'm hoping this is a simple solution.

Cheers, Rob.

 

Rob Ainscough
Top achievements
Rank 1
 answered on 13 Feb 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?