Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
709 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
112 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
104 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
283 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
269 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
1 answer
208 views
Hi,

I am trying to use the logic described in this article (http://www.telerik.com/help/aspnet/grid/radgrid-telerik.webcontrols.gridclientevents-onrequeststart.html) in my RadGrid.  I have it set up as follows:

<ClientSettings EnableRowHoverStyle="true">
    <Selecting AllowRowSelect="True" UseClientSelectColumnOnly="True" />
    <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="False" />
    <ClientEvents OnRowSelected="PaymentLedgerRowSelected" />
    <ClientEvents OnRequestStart="ThisEvent" />
</ClientSettings>

But I am getting the following error:

Validation (ASP.NET): Attribute 'OnRequestStart' is not a valid attribute of elements 'ClientEvents'.

And when I run the code, I get the following error:

Type 'Telerik.Web.UI.GridClientEvents' does not have a public property named 'OnRequestStart'.

Am I missing something?

Thanks,
Jerry
Jayesh Goyani
Top achievements
Rank 2
 answered on 16 Jul 2011
1 answer
152 views
I am currently using the RadFileExplorer in conjunction with a CustomFileSystemProvider (Hooked to a network share, base on a demo I found here). And while I can upload and download files just fine, it appears that creating folders, renaming items, and deleting items all fail. Deleting told me the application did not have sufficient permissions. What permissions are required? I tried setting the folder up for access to Everyone with Full Control, but that did not seem to help. I even attempted to setup the web to run as the local machines Administrator, but still no luck. Any ideas?
Xorcist
Top achievements
Rank 1
 answered on 15 Jul 2011
4 answers
112 views
Hi All

I have two list boxes on a page one is availiablelist the other is selected list,
i need to be able to clear the selected list and pass its values back to the availiable list based on a check box value!
I have tried looping each item but this seems to throw an exception?
For Each SelItem AS RadListBoxItem in Selectedlist
  
availiablelist.Items.Add(SelItem)
  
Next

Could somone give me som guidance on how best to achive this please.

Many Thanks

Regards

Cush
Cush
Top achievements
Rank 1
 answered on 15 Jul 2011
3 answers
112 views
Hi All,

I am attempting to achieve the following functionality: I would like to change the background color of the control the user's mouse is currently over when the user is dragging an item.

Reasoning: I allow the user to drag-and-drop items from a RadListBox onto the page. This drag-and-drop functionality creates RadDocks. Once a RadDock is on the page it set's its RadDockZone is forbidden to all other docks. As such, if I had two docks on the page, I indicate that a 3rd RadDockZone is a viable move option by changing that DockZone's background color to green. I would like this functionality to extend to when the user is first creating their RadDock -- I would like DockZone currently being hovered-over to turn green.

Is this possible? I'm looking through the OnClientDragging event, and I can see that it can return (X,Y) coordinates through use of the get_domevent() method. Is there a way to translate this hit coordinate into the control located at the coordinate? 

Thanks for your time,

Sean Anderson
Sean
Top achievements
Rank 2
 answered on 15 Jul 2011
3 answers
109 views
Hi,
in my scenario i've used AjaxManager inside Master page and AjaxManagerProxy inside the content page. I would to know the best approch to ajaxify the radlistview (sorting, paging) inside the content page considering that in  the master page there is radbutton that update radlistview.
Jayesh Goyani
Top achievements
Rank 2
 answered on 15 Jul 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?