Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
65 views
Hi,
I need to creat a bar chart,but some bars should not be continuous.for example see the attachment given below.Is there any way to do that?
Yavor
Telerik team
 answered on 25 Apr 2012
0 answers
87 views
Hi,

I am binding a radgrid runtime using GridTemplateColumns. In my grid the first 3 columns should be freezed, and from other columns, some contains just lables, and some with radnumerictexboxes.
I've created columns using GridTemplateColumn successfully, but confused with assigning data to the grid. I need to give each lable and numerictextbox a different id, so that i can get the data from it to save in database.
So that is my first question..
1) How can I bind data with different IDs to each control in grid.
2) How can I freeze columns? If i bind grid using SqlDataSource, freezing works perfect, but when it bind it using GridTemplateColumns and all, freezing does not work.

Here is a sample code, please correct me where I am wrong:

<rad:RadGrid ID="radTestInputs" Width="100px"  EnableAJAX="True" AutoGenerateColumns="false"
                EnableAJAXLoadingTemplate="True" GridLines="None" AllowSorting="True" AllowPaging="True"
                runat="server" Skin="WinXP">
                <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">
                    <Resizing AllowColumnResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True" />
                    <Scrolling AllowScroll="True" UseStaticHeaders="True" FrozenColumnsCount="1" />
                </ClientSettings>
                <HeaderStyle Width="100px" />
            </rad:RadGrid>

  Partial Class DefaultVB
        Inherits System.Web.UI.Page
 
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            BindGrid()
        End If
    End Sub
 
    Public Sub BindGrid()
        Dim templateColumnName As String = "Number"
        Dim templateColumn As New GridTemplateColumn()
        templateColumn.ItemTemplate = New MyTemplateCaption("Number")
        templateColumn.HeaderText = templateColumnName
        templateColumn.ItemStyle.Width = Unit.Pixel(80)
        templateColumn.HeaderStyle.Width = Unit.Pixel(80)
        templateColumn.DataField = "Number"
        radTestInputs.MasterTableView.Columns.Add(templateColumn)
        Dim templateColumnName1 As String = "Test"
        Dim templateColumn1 As New GridTemplateColumn()
        templateColumn1.ItemTemplate = New MyTemplateCaption("Test")
        templateColumn1.HeaderText = templateColumnName1
        templateColumn1.ItemStyle.Width = Unit.Pixel(80)
        templateColumn1.HeaderStyle.Width = Unit.Pixel(80)
        templateColumn1.DataField = "Test"
        radTestInputs.MasterTableView.Columns.Add(templateColumn1)
 
        Dim dt As DataTable = New DataTable()
        dt.Columns.Add("Number")
        dt.Columns.Add("Test")
        Dim dr As DataRow = dt.NewRow()
        dr(0) = "1"
        dr(1) = "Test1"
        dt.Rows.Add(dr)
        Dim dr1 As DataRow = dt.NewRow()
        dr1(0) = "2"
        dr1(1) = "Test2"
        dt.Rows.Add(dr1)
        radTestInputs.DataSource = dt
        radTestInputs.DataBind()
    End Sub
End Class


Class MyTemplateCaption
    Implements ITemplate
    Protected lControl As LiteralControl
    Private value As String, id As String
    Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) _
      Implements System.Web.UI.ITemplate.InstantiateIn
 
        lControl = New LiteralControl()
        lControl.ID = value 'How can I provide different id for each control here?
        AddHandler lControl.DataBinding, AddressOf label1_DataBinding
         
        container.Controls.Add(lControl)
 
    End Sub
    Public Sub New(ByVal cValue As String)
        value = cValue
    End Sub
 
    Private Sub label1_DataBinding(ByVal sender As Object, ByVal e As EventArgs)
        Dim target As LiteralControl = DirectCast(sender, LiteralControl)
        Dim item As GridDataItem = DirectCast(target.BindingContainer, GridDataItem)
        Dim row As DataRowView = DirectCast(item.DataItem, DataRowView)
        If (target.ID.ToLower().Contains("number")) Then 'Not proper- here I  Need to assign text according to the control's id
            target.Text = row.Item(0).ToString()
        Else
            target.Text = row.Item(1).ToString()
        End If
 
    End Sub
 
End Class


I've to submit this by tomorrow, please reply whoever knows solution ASAP.
Thanks.
Mansi
Top achievements
Rank 1
 asked on 25 Apr 2012
2 answers
228 views
HI All,
I have a imagebutton in RadGRid with CommanName="Reprocess".
When user click on the imageButton it fire ItemCommand event and check if the checkbox at each row is checked. If it is check then it perform logic A else it perform logic B.

My question is it possible to loop RadGrid in ItemCommand event? Doed anyone as any idea to do this?
Help Please!!


johnson lim
Top achievements
Rank 1
 answered on 25 Apr 2012
1 answer
76 views
Hi All,

I want to know, how to show template GUI in telerik Gridview like GridView from standart control asp.net?

thanks,
Jayesh Goyani
Top achievements
Rank 2
 answered on 25 Apr 2012
4 answers
98 views
Hi,

I have button outside the grid, clicking on the button will add a new row to the grid. I also have edit template also. Is there a way at the client side I can find out if the grid is in edit mode or insert mode....

I am using the below statment to insert a new row in the grid..
 rgHotels.MasterTableView.InsertItem(); 

Jayesh Goyani
Top achievements
Rank 2
 answered on 25 Apr 2012
5 answers
146 views
I am using version Q1 2012 of the ASP.NET AJAX Controls.
I want to create a client-event where I register the column that has been moved and the position it has been dragged to.

I have created clientevents for OnColumnMovedToLeft and for OnColumnMovedToRight.

Within these events I can read 
eventArgs.get_gridColumn()
This is not the column that has been dragged.
How do I get the correct dragged column with it's new position?

Paul
Antonio Stoilkov
Telerik team
 answered on 25 Apr 2012
1 answer
61 views
am keeping selecteddate as current date ...
so when user selects different date that date should be selected indatabase for 
that am using SelectedDateChaged event

how how to get that new date..
am using

in onselect...{

radpicker.selecteddate == it shows the current date 
}


how to get the new date  i have kept auto= true also

Princy
Top achievements
Rank 2
 answered on 25 Apr 2012
1 answer
42 views
Hello Telerik,

I have a radmenu inside a radpone, but when the childrenMenu expand, it can't cross the radpone border.
I found a topic  http://www.telerik.com/community/forums/aspnet-ajax/splitter/radslidingpane-hiding-asp-menu-items.aspx, it seems he has a similar problem, I have tried to fix it, but it still doesn't work.

please see my attachment image

Any help on this matter would be appreciated.
Princy
Top achievements
Rank 2
 answered on 25 Apr 2012
3 answers
298 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
383 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
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?