Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
333 views
Hi,

I am Srinivas,

In my project i have a RadGrid for Displaying Data from Backend Table. Here i am using GroupBy property for My RadGrid. Here i want to Place a Button in RadGrid Header Row along with GroupBy Text.

Here i was Displaying a GroupBy Text successfully. It shown in 1.Jpg Attached file. But along with text i want to Show the Button in RadGroupHeader Row. Like Shown in Attachment 2 (Example Only).

Here The following code for  Group Header Text 
If TypeOf e.Item Is GridGroupHeaderItem Then
Dim item As GridGroupHeaderItem = DirectCast(e.Item, GridGroupHeaderItem)
Dim groupDataRow As DataRowView = DirectCast(e.Item.DataItem, DataRowView)
'Dim nodeCollection As IList(Of RadTreeNode)
item.DataCell.Text = ""
For Each column As DataColumn In groupDataRow.DataView.Table.Columns
If column.ColumnName = "lot_id" And n >= 1 Then
item.DataCell.Text = RadTreeView1.CheckedNodes(item.GroupIndex).FullPath + "<br/>"
<Button Adding>
Dim hyplnk As New Button()
hyplnk.Text = "Redirect"
item.DataCell.Controls.Add(hyplnk)</button>
Else
item.DataCell.Text = RadTreeView1.CheckedNodes(item.GroupIndex).FullPath
End If
Next
End If
But it is not working fine..
Please Help me.

Thanks
D.Srinivas
Princy
Top achievements
Rank 2
 answered on 18 Jul 2011
1 answer
69 views
Hi

I have attached 2 images in this post. Can anyone tell me is it possible to do in radgrid? If it so, please suggest how to achieve ?

Regards
Arima
Princy
Top achievements
Rank 2
 answered on 18 Jul 2011
6 answers
253 views

I have a RadGrid with an OnRowDbClick method set.

This is the code from inside the grid

<ClientSettings EnablePostBackOnRowClick="true">
    <Selecting AllowRowSelect="True" />
    <ClientEvents OnRowDblClick="RowDblClick" />
</ClientSettings>

In the RowDblClick method I get the item index like this.

function RowDblClick(sender, eventArgs) {
         var i =  eventArgs.get_itemIndexHierarchical();
         // rest of this method removed for brevity.    
}

This works.

Now elsewhere on this page I have a simple button.
<input type="button" value="Select" onclick="SetupPageIndexing()" />

function SetupPageIndexing() {
      // ??
}


The button is not part of the grid. It's just a button.

I gave it an OnClick event method however how do I get this eventArgs.get_itemIndexHierarchical() value?  eventArgs is not a property of my buttons click event and as it is not related to the grid in anyway, I can't see how to get this value.





Brad
Top achievements
Rank 1
 answered on 17 Jul 2011
5 answers
249 views
Is there anyway to open raddatepicker on form load?

Thanks
JJ
Top achievements
Rank 1
 answered on 17 Jul 2011
2 answers
103 views
Hello there,

I downloaded trial version and i set up a blank page with Telerik's project template. I added Editor control from Toolbox. I did not set any properties of the Editor. Telerik.Web.UI.DialogHandler's all web.config setup was already in web.config.

All editor dialogs are working properly in my development machine. My development machine and production server are using same version of IIS which is 7.5. I'm not using any URL rewrites.

However, my production server shows blank page when pressing any manager dialogs and some of the dialogs are not working properly. What's the problem?

Thanks in advance!
Gamze
Top achievements
Rank 1
 answered on 16 Jul 2011
3 answers
729 views
Hi

I am having the following issue in RadNumericTextBox which has been placed inside the RadGrid Template column.

1. In SQL my data would be like the following
   
Range
12.12457234
585
23.01
0
1112.792345

When I bind the data to my RadGrid, the RadNumericTextBox by default it takes the decimal point, that is for the second row in the RadGrid the data was binded as 585.00 insted of 585.

Our requirement is to display the exact value which are stored in SQL.
Erik
Top achievements
Rank 2
 answered on 16 Jul 2011
0 answers
115 views
I have the following code which within I am trying to get the selected items into an arraylist which I then put into an email.

My code is adding items to the arraylist however, if more than 1 item is selected, then it duplicates the record with the first ID. so if i select row 3, row 4, row 5 then my output is:

row3, row3, row4, row5

Any ideas please

Protected Sub btnRequestFiles_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnRequestFiles.Click
        If RequestFiles.SelectedItems.Count = 0 Then
            lblNoFilesSelected.Text = "No files have been requested"
        Else
            lblNoFilesSelected.Text = ""
            If String.IsNullOrEmpty(txtEmail.Text) Then
                Dim dvEmailAddress As Data.DataView = GetEmailAddress.Select(DataSourceSelectArguments.Empty)
                txtEmailAddress.Text = dvEmailAddress.ToTable.Rows(0)("EmailAddress")
            Else
                txtEmailAddress.Text = txtEmail.Text
            End If
 
            Dim FileID As Integer
            Dim ArraySelectedFiles As New ArrayList
            For Each item As GridDataItem In RequestFiles.MasterTableView.Items
                If item.Selected Then
                    Dim Filename As String = item("FileNumber").Text.ToString()
                    Session("FileID") = Filename
                    ArraySelectedFiles.Add(Session("FileID"))
                    FileID = Convert.ToInt32(item.GetDataKeyValue("FileID"))
                    'Grab the objects out array and put into string.
                    For Each objitem In ArraySelectedFiles.ToArray
                        Session("PropertyString") = Session("PropertyString") & objitem.ToString
                        lblArrayList.Text = Session("PropertyString")
                    Next
                    Dim conFiles As SqlConnection
                    Dim strConnection As String
                    Dim cmd As New SqlCommand
                    Dim cmdinsert As SqlCommand
                    Dim strInsert As String
 
                    strConnection = ConfigurationManager.ConnectionStrings("FileawaySQLConnectionString").ConnectionString
                    conFiles = New SqlConnection(strConnection)
                    conFiles.Open()
                    cmd.Connection = conFiles
                    cmd.CommandText = "UPDATE dbo.Files SET FileStatus = 2 WHERE FileID = '" + FileID.ToString() + "'"
                    cmd.ExecuteNonQuery()
                    conFiles.Close()
                    conFiles = New SqlConnection(strConnection)
                    strInsert = "INSERT INTO dbo.FileHistory (FileID, Action, ActionedBy) VALUES (@RowID, @Action, @ActionedBy)"
                    cmdinsert = New SqlCommand(strInsert, conFiles)
                    cmdinsert.Parameters.AddWithValue("@RowID", FileID)
                    cmdinsert.Parameters.AddWithValue("@Action", 2)
                    cmdinsert.Parameters.AddWithValue("@ActionedBy", txtEmailAddress.Text)
                    conFiles.Open()
                    cmdinsert.ExecuteNonQuery()
                    conFiles.Close()
 
 
 
 
                End If
 
 
            Next
 
            Me.RequestFiles.Rebind()
 
            send_email()
 
 
        End If
        Session.Remove("PropertyString")
 
       
 
    End Sub

Andrew
Top achievements
Rank 1
 asked on 16 Jul 2011
1 answer
111 views
Hello,

So I need to put information on a grid that has the following structure:

SampleNumber(varchar20)
Date(DateTime)
Notes(text)
IsValid(bit)

the last column (IsValid) does not need to be visible, but if it is set to false, then that particular row needs to be selected. No checkbox or command buttons are needed, the row will be selected only if IsValid == false, hence, everything has to be server side.

Any hint will be appreciated, thanks!
Jayesh Goyani
Top achievements
Rank 2
 answered on 16 Jul 2011
1 answer
296 views
Hello,

i'm trying to select items from a check box on a radgrid but the RadGrid1_ItemCommand does't work...

this is my codebehind
namespace Website
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                RadGrid1.DataSource = getDataSource();
                RadGrid1.DataBind();
            }
        }


        private DataTable getDataSource()
        {
            var dt = new DataTable();
            dt.Columns.Add("IDLOTE");
            dt.Columns.Add("DESC");


            for (int i = 1; i <= 20; i++)
            {
                DataRow dr = dt.NewRow();
                dr["IDLOTE"] = i;
                dr["DESC"] = "desc" + i;
                dt.Rows.Add(dr);
            }
            return dt;
        }


        protected void CheckUnckeckAll(object sender, EventArgs e)
        {
        }


        protected void CheckUncheckItem(object sender, EventArgs e)
        {
            ((sender as CheckBox).NamingContainer as GridItem).Selected = (sender as CheckBox).Checked;
        }


        protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
        {
            ArrayList selectedItems;
            if (Session["selectedItems"] == null)
            {
                selectedItems = new ArrayList();
            }
            else
            {
                selectedItems = (ArrayList)Session["selectedItems"];
            }
            if (e.CommandName == RadGrid.SelectCommandName && e.Item is GridDataItem)
            {
                GridDataItem dataItem = (GridDataItem)e.Item;
                string customerID = dataItem.OwnerTableView.DataKeyValues[dataItem.ItemIndex]["IDLOTE"].ToString();
                selectedItems.Add(customerID);
                Session["selectedItems"] = selectedItems;
            }
            if (e.CommandName == RadGrid.DeselectCommandName && e.Item is GridDataItem)
            {
                GridDataItem dataItem = (GridDataItem)e.Item;
                string customerID = dataItem.OwnerTableView.DataKeyValues[dataItem.ItemIndex]["IDLOTE"].ToString();
                selectedItems.Remove(customerID);
                Session["selectedItems"] = selectedItems;
            }
        }


        protected void RadGrid1_PreRender(object sender, EventArgs e)
        {
            if (Session["selectedItems"] != null)
            {
                ArrayList selectedItems = (ArrayList)Session["selectedItems"];
                Int16 stackIndex;
                for (stackIndex = 0; stackIndex <= selectedItems.Count - 1; stackIndex++)
                {
                    string curItem = selectedItems[stackIndex].ToString();
                    foreach (GridItem item in RadGrid1.MasterTableView.Items)
                    {
                        if (item is GridDataItem)
                        {
                            GridDataItem dataItem = (GridDataItem)item;
                            if (curItem.Equals(dataItem.OwnerTableView.DataKeyValues[dataItem.ItemIndex]["CustomerID"].ToString()))
                            {
                                dataItem.Selected = true;
                                break;
                            }
                        }
                    }
                }
            }
        }
        protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            RadGrid1.DataSource = getDataSource();
        }
    }
}

this is the view,

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Website.WebForm1" %>


<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
        <!-- content start -->
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadGrid ID="RadGrid1" runat="server" OnItemCommand="RadGrid1_ItemCommand"
            OnPreRender="RadGrid1_PreRender" OnNeedDataSource="RadGrid1_NeedDataSource" GridLines="None"
            AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" Skin="Windows7"
            AllowMultiRowSelection="True" Culture="pt-PT" Width="900px" PageSize="5">
            <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True" EnableRowHoverStyle="true">
                <Selecting AllowRowSelect="true" />
                <Resizing AllowRowResize="False" EnableRealTimeResize="False" ResizeGridOnColumnResize="False"
                    AllowColumnResize="False"></Resizing>
            </ClientSettings>
            <MasterTableView AllowMultiColumnSorting="true" AutoGenerateColumns="False" DataKeyNames="IDLOTE">
                <Columns>
                    <telerik:GridButtonColumn Visible="false" Text="Select" CommandName="Select" />
                    <telerik:GridButtonColumn Visible="false" Text="Deselect" CommandName="Deselect" />
                    <telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn" AllowFiltering="false">
                        <HeaderTemplate>
                            <asp:CheckBox ID="headerChkbox" OnCheckedChanged="CheckUnckeckAll" AutoPostBack="True"
                                runat="server"></asp:CheckBox>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:CheckBox ID="CheckBox1" OnCheckedChanged="CheckUncheckItem" AutoPostBack="True"
                                runat="server"></asp:CheckBox>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn DataField="IDLOTE" HeaderText="IDLOTE" ReadOnly="True" SortExpression="DESC"
                        UniqueName="IDLOTE">
                        <HeaderStyle Width="120px" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="DESC" HeaderText="DESC" SortExpression="DESC"
                        UniqueName="DESC">
                        <HeaderStyle Width="340px" />
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
            <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
        </telerik:RadGrid>
    </div>
    </form>
</body>
</html>


what can be wrong?

Jayesh Goyani
Top achievements
Rank 2
 answered on 16 Jul 2011
4 answers
282 views

Dear Team,


I want to achieve the below.

I have a parent page which displays the details about a project. From this, on a button click , I open a radwindow which displays some specific details about the project which displayed in the parent window. The radpopup window has some textboxes and other controls with values along with a UPDATE button.

What I need is, if I change values in the popup and try to close the radwindow without update, it should ask me a confirmation that”
Are you sure to close this window without updating your data? The changes will be lost!! Click on CANCEL to return to the window and update". If i try to close the popup radwindow after updated [ie,if I not changed any values after updated] or without any change, it should not ask the confirmation before close the radpopupwindow.

Please help me to achieve this.

dhamo
Top achievements
Rank 1
 answered on 16 Jul 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?