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

I would like to know how to reset the control completely.

My upload control is in a popup (a simple absolute div) and has its own "Close" button. When the popup is closed, I want the Telerik control to completely reset, whether or not it is currently uploading or what state it is ...

I have tried using:
- deleteFileInputAt(0);
- _uploading = 0; i'm pretty sure this is not the way to go...
- _cancelUpload: this crashes a lot ... (stackoverflows etc....)

I'm searching for a reliable method to re-initialize the control like when the page was loaded.

Thanks !
Princy
Top achievements
Rank 2
 answered on 25 Apr 2012
5 answers
444 views
Hi everybody,
i have a RadGrid which I've added a GridImageColumn.
Sureley i want a reaction on Clicking the Imagebutton therefore but none of the Clicking-Event doesn't work.

I added directly by creating the GridImagebutton an OnClientClick-Method and a OnClick-Method.
I also tried to use the ItemCreated-Event of the Radgrid and adding the Click-Functionalty also there.

Anybody can help me?
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DefaultCS.aspx.cs" Inherits="TelerikNestedGrid.DefaultCS" %>
 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/tr/xhtml11/DTD/xhtml11.dtd">
<head id="Head1" runat="server">
    <!-- custom head section -->
    <!-- end of custom head section -->
</head>
<body class="BODY">
    <form runat="server" id="mainForm" method="post">
    <!-- content start -->
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
    <script language="javascript" type="text/javascript">
        function testAlert() {
            alert("hello");
        }
    </script>
    <br />
    <div style="width: 730px;">
        <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        </telerik:RadAjaxManager>
        <br />
    </div>
    <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="testAlert()"/>
 
    <!-- content end -->
    </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 Telerik.Web.UI;
using System.Data;
using System.IO;
using System.Data.Odbc;
 
namespace TelerikNestedGrid
{
    public partial class DefaultCS : System.Web.UI.Page
    {       
        private void DefineGridStructure()
        {
 
            RadGrid RadGrid1 = new RadGrid();
            RadGrid1.ID = "RadGrid1";
            RadGrid1.ItemCreated += new GridItemEventHandler(RadGrid1_ItemCreated);
             
            //Assignt the DataTable as Source
            RadGrid1.DataSource = GetTableFromCSV(@"D:\RadGridImport.csv"); ;
 
            //If only Bind the Data here, the ImageColumn will not appear.
            RadGrid1.DataBind();
 
            //Create and Add the new Column
            GridImageColumn col = new GridImageColumn();
            col.ImageUrl= "/images/stift_icon.gif";
            GridImageButton btn = new GridImageButton(col);
            btn.OnClientClick = "testAlert()";
            btn.Click += new ImageClickEventHandler(GridButton_Click);
            RadGrid1.Columns.Add(col);
 
 
            //If i first Bind and then Rebind() here, the ImageColumn is at the Beginning.
            RadGrid1.Rebind();
 
            this.PlaceHolder1.Controls.Add(RadGrid1);
        }
 
        public void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                //e.Item.Cells[0].Controls[0].GetType() -> type is usual button and not GridImageButton? Why that?
                TableCell t = e.Item.Cells[0];
                foreach (Control c in t.Controls)
                {
                    c.GetType();
                    //(c as ImageButton).OnClientClick = "testAlert()";
                    (c as Button).OnClientClick = "testAlert()";
                    (c as Button).Click += new EventHandler(GridButton_Click);
                    (c as Button).Attributes.Add("onclick", "GridButton_Click()");
 
                }
            }
        }
 
        public void GridButton_Click(object sender, EventArgs e)
        {
            Console.WriteLine();
        }
 
        protected void Page_Init(object source, System.EventArgs e)
        {
            DefineGridStructure();
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
 
        }
 
        private DataTable GetTableFromCSV(string path)
        {
            if (!File.Exists(path))
                throw new FileNotFoundException();
 
            FileInfo fileInfo = new FileInfo(path);
            DataTable dataTable = new DataTable();
            string connectionString = String.Format("Driver={{Microsoft Text Driver (*.txt; *.csv)}};Dbq={0};", fileInfo.DirectoryName);
            OdbcConnection connection = new OdbcConnection(connectionString);
            OdbcDataAdapter da = new OdbcDataAdapter(String.Format("select * from [{0}]", fileInfo.Name), connection);
            da.Fill(dataTable);
            return dataTable;
        }
    }
}

C
Shinu
Top achievements
Rank 2
 answered on 25 Apr 2012
1 answer
121 views

Hello :)

I have a Rad grid view, which contain a button in each row

I want to do something with the data key (the primary key ) of the grid when I press a button in some row

can I retrieve the data key for used row to use it in my C# code ?

thank you all :)

Shinu
Top achievements
Rank 2
 answered on 25 Apr 2012
0 answers
146 views

I have an application that was given to my by someone else and it's using telerik controls.

the application is originally written in VS2010 framework 4.

when i try to open it on my end, i keep getting errors saying "failed to create designed "Error Creating Control - RadScriptManager1Failed to create designer 'Telerik.Web.UI.RadScriptManager, Telerik.Web.UI, Version=2011.1.519.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4'"

the telerik.web.ui.dll file is in my "bin" folder.

am i missing something? is there a way to get the site to work without having to buy these controls? what do i do?

Tanya
Top achievements
Rank 1
 asked on 25 Apr 2012
4 answers
120 views
Hi,

I can set the "window close" animations for the RadWindow control.  How do I set animations for Window Maximize (which puts the window to full-screen), and Window Restore (which puts the window back to partial screen)?

Thanks!

andy
Top achievements
Rank 1
 answered on 24 Apr 2012
3 answers
162 views
Hi,

I am trying to understand why my combo box is always empty in the ItemRequested event eventhough I have some items in my Combo... My Event is similair to the load on demand demo. My combo works fine for the client, my problem is on the server, it is empty.

So why?
Jocelyn
Top achievements
Rank 1
 answered on 24 Apr 2012
2 answers
588 views
Here is the scenario:

  •   I have a RadGrid with 3 columns -- Qty -- Description -- Price Per
  •   Data comes in from the server - as a list of items you can select
  •   The Qty column is a RadNumbericTextbox with spinner buttons -- Price Per is set from the database
  •   When you change the Qty, I want to recalculate the total of all lines for the entire grid and show it in a separate RadNumbericTextbox outside of the RadGrid
  •   The math is the sum of Qty * Price Per for all lines.

Attached screenshot shows the grid I am dealing with to give a clear idea...
Dan
Top achievements
Rank 1
 answered on 24 Apr 2012
3 answers
331 views
Is there a good tutorial or documentation that explains this control and how it works.  We just purchased the controls at my work and i'm trying to learn as much about them as possible.  I'm not sure what this control does and how exactly to use it.  Any help would be appreciated.

Thank you
Eyup
Telerik team
 answered on 24 Apr 2012
1 answer
142 views
The behavior I'm seeing is that scrollIntoView() modifies the position of the scrollbar even when the node in question is already in view.  Is there a way to prevent this?  In attempting to accomplish this, I haven't been able to find a property on the node that describes whether it is already in view.  Can anyone help?

Phil
Plamen
Telerik team
 answered on 24 Apr 2012
3 answers
244 views
Hi

I'm using a Radgrid, fairly simple implementation:

<telerik:RadGrid ID="approval" runat="server" AutoGenerateColumns="False"
            CellSpacing="0" GridLines="None" AllowFilteringByColumn="true"
            onneeddatasource="approval_NeedDataSource"
            OnItemCommand="approval_ItemCommand" OnInit="approval_Init" >

<MasterTableView allowpaging="True" datakeynames="Id" AllowSorting="true"
    name="claims" commanditemdisplay="Bottom"  AllowFilteringByColumn="true">

I'm having an issue with the filter options, I have enabled column filtering and this is working fine.  I want to limit the number of filter options available.  I followed this guide: http://www.telerik.com/help/aspnet-ajax/grid-reducing-filtermenu-options.html 

I created an Init handler:
protected void approval_Init(object sender, EventArgs e)
{
    GridFilterMenu menu = approval.FilterMenu;
    int i = 0;
    while (i < menu.Items.Count)
    {
        if (menu.Items[i].Text == "NoFilter" || menu.Items[i].Text == "Contains" || menu.Items[i].Text == "DoesNotContain"  || menu.Items[i].Text == "EqualTo" || menu.Items[i].Text == "GreaterThan" || menu.Items[i].Text == "LessThan")
        {
            i++;
        }
        else
        {
            menu.Items.RemoveAt(i);
        }
    }
}


However this isn't working, if I attach a breakpoint the code isn't being hit.

Any advice?

Thanks
Contact
Top achievements
Rank 1
 answered on 24 Apr 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?