Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
299 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
223 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
360 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
119 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.4K+ 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
1 answer
124 views

I can reference ButtonType="LinkButton" in the ItemDataBound method but not a ButtonType="PushButton"?  I can't seem to locate the correct reference for PushButton?

This works but only for LinkButton

Dim ditem As GridDataItem = CType(e.Item, GridDataItem)

Dim ReserveButton As LinkButton = CType(ditem("gbtc_Reserve").Controls(0), LinkButton)

This triggers and error:

Dim ditem As GridDataItem = CType(e.Item, GridDataItem)

Dim ReserveButton As RadPushButton = CType(ditem("gbtc_Reserve").Controls(0), RadPushButton)

Cheers, Rob.

Rob Ainscough
Top achievements
Rank 1
 answered on 13 Feb 2019
4 answers
344 views

I have a RadGrid and a button.

In the RadGrid, one column is a GridClientSelectColumn.

I have tried to have a javascript function to enable/disable the button depending on whether one or more rows are selected.

It will however fail to find the button, because $find will return null. Why?

aspx:

<telerik:RadGrid ID="grdActivitiesToCopy" Skin="Metro" AutoGenerateColumns="False"
        AllowMultiRowSelection="True" runat="server">
        <MasterTableView DataKeyNames="id" ClientDataKeyNames="id">
                <Columns>
                        <telerik:GridClientSelectColumn UniqueName="DetailCheckColumn" />
                </Columns>
        </MasterTableView>
        <ClientSettings>
                <Selecting AllowRowSelect="true" />
                <ClientEvents OnGridCreated="on_grid_created()"></ClientEvents>
        </ClientSettings
</telerik:RadGrid>
<div style="padding-top: 14px">
        <telerik:RadButton Text="Copy" ID="btnCopy" runat="server"/>
</div>

javascript:

var btnCopyId = "<%=btnCopy.ClientID %>";
 
function on_grid_created()
{
  $(":checkbox").on('change', function ()
  {
    update();
  });
 
  update();
 
  function update()
  {
    var enabled = $(":checkbox:checked").length > 0;
 
    $find(btnCopyId).set_enabled(enabled);
  }
}

 

 

 

Dehanys
Top achievements
Rank 2
 answered on 12 Feb 2019
0 answers
233 views

I have created radwizardsteps dynamically, which is in a user control, onstep change i am creating another rad wizard with 4 steps dynamically and every step contains a dynamic table. Now the problem is if i make a another ajax request the controls in the 2nd wizard getting destroyed, how can i maintain this controls can someone help out to resolve this.
Thanks.

Usercontrol.ascx:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WizardUCDemo.ascx.cs" Inherits="WebUIFrameWork.UITemplate.WizardUCDemo" %>
<telerik:RadCodeBlock runat="server" ID="RadCodeBlock1">
<script type="text/javascript">
    function OnWizardstepChange() {
        var radManager = null;
        var stepIndex = $find("<%= wizardControl.ClientID %>").get_activeIndex();
        radManager = $find('<%=RadAjaxManager.GetCurrent(this.Page).ClientID%>');
        radManager.ajaxRequest("StepChange&"+stepIndex);
    }
</script>
</telerik:RadCodeBlock>
<telerik:RadWizard runat="server" RenderMode="Lightweight" ID="wizardControl" OnClientButtonClicked="OnWizardstepChange"
    DisplayProgressBar="false" ProgressBarPosition="Right" NavigationBarPosition="Right"
    NavigationButtonsPosition="Bottom" DisplayNavigationButtons="false">
</telerik:RadWizard>

 

Usercontrol.ascx.cs:

public void GenerateSteps()
{
 for (int i = 1; i < 5; i++)
 {
    Step = new RadWizardStep();
    Step.ID = "Step_" + i.ToString();
    Step.ClientIDMode = ClientIDMode.Static;
 
    Table = new Table();
    Table.ID = "Table" + i.ToString();
    Table.ClientIDMode = ClientIDMode.Static;
    newStep.Controls.Add(newTable);
    UIControlsWizard.WizardSteps.Add(newStep);
 }

aspx:

<telerik:RadCodeBlock runat="server">
<script type="text/javascript">
      function testMethod()
      {
          $find("<%= RadAjaxManager1.ClientID%>").ajaxRequest("demo")
      }
</script>
</telerik:RadCodeBlock>
 
<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
       <AjaxSettings>
           <telerik:AjaxSetting AjaxControlID="wizardControl">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="wizardControl" />
               </UpdatedControls>
           </telerik:AjaxSetting>
       </AjaxSettings>
</telerik:RadAjaxManager>
 <table>
        <tr>
            <td>
                <uc1:WizardUCDemo runat="server" ID="WizardUCDemo1" />
            </td>
            <td>
                <telerik:RadWizard runat="server" RenderMode="Lightweight" ID="RadWizard1" DisplayProgressBar="false"
                    ProgressBarPosition="Right" NavigationBarPosition="Right" NavigationButtonsPosition="Bottom"
                    DisplayNavigationButtons="false">
                </telerik:RadWizard>
            </td>
        </tr>
    </table>

 

aspx.cs:

Table newTable;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            WizardUCDemo.GenerateSteps();
        }
    }
public void reProduceWizardSteps()
{
   RadWizardStep newStep;
   for (int i = 1; i < 5; i++)
   {
       newStep = new RadWizardStep();
       newStep.ID = "newStep_" + i.ToString();
       newStep.ClientIDMode = ClientIDMode.Static;
 
       newTable = new Table();
       newTable.ID = "newTable" + i.ToString();
       newTable.ClientIDMode = ClientIDMode.Static;
       TableRow tRow = new TableRow();
       TableCell tCell = new TableCell();
 
       RadTextBox rtxtBoxNew = new RadTextBox();
       rtxtBoxNew.ID = "newTextBox_" + i.ToString();
       rtxtBoxNew.ClientIDMode = ClientIDMode.Static;
       rtxtBoxNew.ClientEvents.OnKeyPress = "testMethod";
       tCell.Controls.Add(rtxtBoxNew);
       tRow.Cells.Add(tCell);
       newTable.Controls.Add(tRow);
       newStep.Controls.Add(newTable);
       UIControlsWizard.WizardSteps.Add(newStep);
    }
}
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
   string commandText = e.Argument.ToString().Trim();
   var commandData = commandText.Split('&');
   commandText = commandData[0];
   switch (commandText)
   {
      case "StepChange":
          if (Convert.ToInt32(commandData[1])==1)
          {
              reProduceWizardSteps();
          }
              break;
   }
}

 

Saifulla
Top achievements
Rank 1
 asked on 12 Feb 2019
1 answer
228 views

I'm implementing a grid with a group footer, similar to what is illustrated in this telerik example:

Telerik Example

Everything works great, but users complain the grid's footer subtotals are confusing because "i can't tell which level the subtotal line applies to".

So, given the photo, is there an easy way to access the group expression to display it in the footer, i.e. on the "count 30" line add text along the lines of "Subtotals: Ernst Handel" and on the "Count 40" line add text reading "Subtotals: Austria"?

 

Eric R | Senior Technical Support Engineer
Telerik team
 answered on 11 Feb 2019
6 answers
1.2K+ views
I am trying to enter a line break / carriage return in a combo box.  The data in the combo box is long and I want to replace the "-" with a carriage return.  Below is my code that is not working, wondering if this is even possible with the RadComboBox.


PharmacyLocationCollection pharmcol =
new Select()
.From(Tables.PharmacyLocation)
.OrderAsc(PharmacyLocation.Columns.Location)
.ExecuteAsCollection<PharmacyLocationCollection>();
 
 //ddlLocation.Items.Insert(0, new RadComboBoxItem("--select a location--", "0"));
 if (pharmcol.Count > 0)
 {
     int i = 0;
     foreach (PharmacyLocation p in pharmcol)
     {
         string loc = p.Location.ToString();
         loc = loc.Replace("-", "\n");
         ddlLocation.Items.Insert(i, new RadComboBoxItem(loc, p.RXPharmacyID.ToString()));
         i++;
     }
     ddlLocation.Enabled = true;
 }
MV
Top achievements
Rank 1
 answered on 11 Feb 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?