Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
72 views

Hi,

I have created a dynamic grid. but sorting not working.

here is my code.

aspx code

<telerik:RadGrid ID="radGridBICheckData" runat="server" SkinID="RadGrid">
<ClientSettings>
<Resizing EnableRealTimeResize="True" ResizeGridOnColumnResize="True" AllowColumnResize="True"
ClipCellContentOnResize="True" AllowResizeToFit="True"></Resizing>
</ClientSettings>
</telerik:RadGrid>

 

code behind

protected void Page_Init(object sender, EventArgs e)
{
try
{
                                
                DefineGridStructure();
}
catch (Exception ex)
{
Logger.Write(ex.Message, "Error", 0);
NISP.Utilities.ErrorPage.ErrorLog(ex);
}
}

private void DefineGridStructure()
{
//Defines the Grid structure
radGridBICheckData.AutoGenerateColumns = false;
radGridBICheckData.AllowMultiRowSelection = true;
radGridBICheckData.AllowFilteringByColumn = true;
radGridBICheckData.GridLines = GridLines.None;
radGridBICheckData.AllowSorting = true;
// radGridBICheckData.EnableViewState = true;
String htmlColor = "#EDEFF1";
Color backColor = ColorTranslator.FromHtml(htmlColor);
radGridBICheckData.AlternatingItemStyle.BackColor = backColor;
String editColor = "#A2A2A2";
Color editbackColor = ColorTranslator.FromHtml(editColor);
radGridBICheckData.MasterTableView.AllowSorting = true;
radGridBICheckData.MasterTableView.AllowCustomSorting = true;
radGridBICheckData.MasterTableView.AllowFilteringByColumn = true;
radGridBICheckData.MasterTableView.AllowPaging = true;
radGridBICheckData.MasterTableView.AllowCustomPaging = true;
// radGridBICheckData.MasterTableView.CanRetrieveAllData = true;
radGridBICheckData.MasterTableView.PagerStyle.AlwaysVisible = true;
radGridBICheckData.MasterTableView.PagerStyle.Position = GridPagerPosition.Bottom;
radGridBICheckData.MasterTableView.PagerStyle.Mode = GridPagerMode.NextPrevNumericAndAdvanced;
radGridBICheckData.ClientSettings.AllowKeyboardNavigation = true;
radGridBICheckData.ClientSettings.Selecting.AllowRowSelect = true;
radGridBICheckData.ClientSettings.Scrolling.AllowScroll = true;
radGridBICheckData.ClientSettings.Scrolling.UseStaticHeaders = true;
radGridBICheckData.ClientSettings.Scrolling.ScrollHeight = Unit.Pixel(390);
radGridBICheckData.FilterMenu.EnableTheming = true;
radGridBICheckData.FilterMenu.CollapseAnimation.Duration = 200;
radGridBICheckData.FilterMenu.CollapseAnimation.Type = AnimationType.OutQuint;
//Add Master table
radGridBICheckData.MasterTableView.Name = "BICheck";
string[] resolutionArr;
if (SessionManager.GetSessionObject("ScreenResolution") != null)
{
resolutionArr = SessionManager.GetSessionObject("ScreenResolution").ToString().Split('*');
ApplicaionResolutionSettings.ResizingGridForResolution(ApplicationConstants.RES_FILE_TEMPLATE_ROW_DEFINITION, resolutionArr, radGridBICheckData, ApplicationConstants.RES_POPUP_SINGLE_GRID);
}

radGridBICheckData.MasterTableView.EnableColumnsViewState = false;
//GridEditCommandColumn col1 = new GridEditCommandColumn();
//col1.ButtonType = GridButtonColumnType.ImageButton;
//col1.UpdateImageUrl = "../App_Themes/Default/Grid/Update.gif";
//col1.EditImageUrl = "../App_Themes/Default/Grid/Edit.gif";
//col1.InsertImageUrl = "../App_Themes/Default/Grid/Insert.gif";
//col1.CancelImageUrl = "../App_Themes/Default/Grid/Cancel.gif";
//col1.Visible = true;
//col1.UniqueName = "EditCommandColumn";
//grid.MasterTableView.Columns.Add(col1);
GridBoundColumn boundColumn;
string uniqueName = string.Empty;
for (int intIndex = 0; intIndex <= 20; intIndex++)
{
boundColumn = new GridBoundColumn();
if (intIndex == 0)
{
uniqueName = "STATUS";
boundColumn.AllowFiltering = false;
// boundColumn.AllowSorting = false;
}
else
{
uniqueName = "Value" + intIndex;
boundColumn.AllowFiltering = true;
// boundColumn.AllowSorting = true;
}

boundColumn.DataField = uniqueName;
boundColumn.HeaderText = "";
boundColumn.UniqueName = uniqueName;
boundColumn.SortExpression = uniqueName;
//boundColumn.AllowFiltering = true;
//boundColumn.AllowSorting = true;
boundColumn.HeaderStyle.Width = Unit.Pixel(120);
radGridBICheckData.MasterTableView.Columns.Add(boundColumn);
}
radGridBICheckData.NeedDataSource += new GridNeedDataSourceEventHandler(this.radGridBICheckData_NeedDataSource);
radGridBICheckData.ItemDataBound += new GridItemEventHandler(this.radGridBICheckData_ItemDataBound);
radGridBICheckData.ItemCommand += new GridCommandEventHandler(this.radGridBICheckData_ItemCommand);
// radGridBICheckData.PreRender += new EventHandler(radGridBICheckData_PreRender);
}

 

thanks in advance.

rosali
Top achievements
Rank 1
 asked on 20 Mar 2017
1 answer
97 views

Hi, I have a question. When I do inline editing: I have a number of columns with integers. When I want to inline edit a column it works perfect.

However, I notice that when I "in" a cell and I use my mouse wheel the value goes up or down.

I don't want that tp happen because it can confuse people.

How to prevent this?

Rumen
Telerik team
 answered on 19 Mar 2017
6 answers
987 views
Hello All

i want bind my grid on client side after click on a button, my code is very very simple but when i want catch table view with this code,returns null
var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();

this is my full client side code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script language="javascript" type="text/javascript">
        function Button1_onclick() {          
                var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
                PageMethods.GetData(1, true, updateGrid);
            }
 
            function updateGrid(result) {
                var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
                tableView.set_dataSource(result);
                tableView.dataBind();
            }
 
 
    </script>   
    </telerik:RadCodeBlock>
</head>
<body>
    <form id="form1" runat="server">
    <input id="Button1" type="button" value="button" onclick="return Button1_onclick()" />
    <telerik:RadScriptManager ID="RadScriptManager1" Runat="server" EnablePageMethods="true">
    </telerik:RadScriptManager>
    <br />
    <telerik:RadGrid ID="RadGrid1" runat="server"  EnableViewState="false">
    <MasterTableView>
        <Columns>
          <telerik:GridBoundColumn DataField="pic" HeaderText="pic" />
        </Columns>
    </MasterTableView>
    </telerik:RadGrid>
    </form>
</body>
</html>

this is my full server side code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Services;
using System.Data;
 
public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
 
    [WebMethod]
    public static List<object> GetData(int departmentID, bool SelectSubNodesPersonels)
    {
        DAL.Personels ObjPersonels = new DAL.Personels();
        DataTable DT = ObjPersonels.Personels_SELECT_BY_DepartmentID(departmentID, SelectSubNodesPersonels);
 
        return ObjPersonels.Convert_DataTable_To_List_Object(DT);
    }
}

what is the problem do you think.

Special thanks
Mohammd
Mukku
Top achievements
Rank 1
 answered on 18 Mar 2017
2 answers
130 views
Is there a way to use topojson with RadMap?
David
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 17 Mar 2017
6 answers
277 views
Is there a way or property to sisable browser autocomplete suggestions for Treeview node when editing?
Praveen
Top achievements
Rank 1
 answered on 17 Mar 2017
6 answers
2.1K+ views
Hi,
My project is using .net framework 3.5 and telerik version 2008.03.1314.35 but this version not support IE

http://www.telerik.com/community/forums/aspnet-ajax/form-decorator/javascript-error-when-using-formdecorator.aspx

 Probably this problem fixed in 2009 versions.

How can i download 2009 SP2 version ?
Huynh Nhat
Top achievements
Rank 1
 answered on 17 Mar 2017
3 answers
107 views

My boss and I want to add the RadAsyncUpload control to our website with the target folder being on a GoDaddy Shared Virtual Hosting Account. Now, this means that we have to pass through credentials to do this. After doing some Googling I found an instance where it was suggested to use an OnFileUploaded event to FTP the file up to the server (http://www.telerik.com/forums/use-radupload-to-trasfer-to-ftp-site).

This seems like an extra bit of work for something that should be really simple.

Is there a simpler way to go about this?

Marin Bratanov
Telerik team
 answered on 16 Mar 2017
1 answer
154 views

In several of my controls if I use ConfirmDialogType="Radwindow" the window dialogue appears, click 'Yes' and the delete is cancelled, but if I switch to "Classic" the delete works fine?

 

Marin Bratanov
Telerik team
 answered on 16 Mar 2017
29 answers
560 views
It seems there is demo that actually works : http://demos.telerik.com/aspnet-ajax/grid/examples/functionality/exporting/excel-export/defaultcs.aspx
However, there is broken link to aspx.vb/aspx.cs files

Any suggestions?
MBEN
Top achievements
Rank 2
Veteran
 answered on 16 Mar 2017
3 answers
771 views
Just a quick question to ask if documentation exists for older versions of the .Net AJAX controls? i ask as some of the syntax changes from time to time so it would be useful to have documentation for specific versions of the controls.
Vessy
Telerik team
 answered on 16 Mar 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?