Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
81 views
Does anyone have a good technique for connecting a RadGrid to a SharePoint list while still keeping all the design time features of the RadGrid? I don't. Here's everything I've tried and what sucks about it. BTW, I'm not blaming Telerik. This is more of a VS <--> SP problem.

Using SP Metal, I've create all the classes to connect to my SharePoint data. Now I'm stuck at connecting this to a RadGrid (or even a built in GridView). You have to have a data source to connect to. Logic says that you should use a LinqDataSource. Unfortunately, that control isn't "native" to the SP visual web part template. You'll have to go into the ascx and add <%@ Register Tagprefix="aspweb" Namespace="System.Web.UI.WebControls" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %> so that you can use <aspweb:LinqDataSource />. The RadGrid easily connects to the LinqDataSource, but you can't configure the LinqDataSource to connect DataContext object created with SP Metal. The only thing I can find online is using the Selecting event of the LinqDataSource to populate the data, or not using the LinqDataSource and populate the RadGrid's DataSource in the page Load event, or the RadGrid's NeedDataSource event. All of those options destroy the chance to use the nice design-time editor Telerik has designed for the RadGrid.

I've tried this same thing outside of a SP template and had no problems (aside from an annoying Microsoft.Sharepoint.Sandbox.dll file that keeps getting added to the bin\ folder that you have to delete).

Am I missing something? I doubt I'm the only one trying to display SP list data in a grid and use the editor to do my styling. This is driving me up a wall. I've thought about creating all the user controls outside of a SP template and then trying to load those, or creating my own type of data source to wrap around the Metal classes, but this seems a bit too complicated. Am I doing something wrong, or does anyone have a clean solution to my problem?


Tsvetoslav
Telerik team
 answered on 09 Oct 2012
1 answer
90 views
I am having issue when i click edit button, the previous records are coming grid need to refresh.
Andrey
Telerik team
 answered on 09 Oct 2012
8 answers
603 views
How can I simulate a client-side onClick event for a list item located at the 0 index of the control?  Thanks in advance for assistance.
Plamen
Telerik team
 answered on 09 Oct 2012
3 answers
113 views

I have a 2 treeviews lets say tree1 and tree2.
tree1 has checkbox nodes
I drag and drop the checked nodes from tree1 to tree2.
On tree1_nodedrop, trying to read those checkednodes using Tree1.CheckedNodes() and it is always returning 0.
Earlier it used to work, i'm not sure whether is stop working after SP1 installation or VS2012 installation.

Telerik Current Version: 2012.2.724.40 (2012 Q2 SP1)
Code Editor: Visual Studio 2010
Framework: 4.0
Tree1 ASPX  Code:
<telerik:RadTreeView ID="tree1" runat="server" Skin="Windows7" DataFieldID="ID"

 

 

 

 

DataFieldParentID="ParentID" DataTextField="NodeText" EnableDragAndDrop="true"

 

 

 

 

CheckBoxes="true" CheckChildNodes="true" DataValueField="ValueID">

Code Behind:
Private Sub tree1_NodeDrop(sender As Object, e As Telerik.Web.UI.RadTreeNodeDragDropEventArgs) Handles tree1.NodeDrop
For Each node As RadTreeNode In tree1.CheckedNodes
// do something

 

 

 

Next

 

 

 

End Sub

What am i missing here?

 

Nencho
Telerik team
 answered on 09 Oct 2012
1 answer
167 views
Hi,

I am looking for custom pagination in Pivot Grid and also a way to hide the Total's Row for each group.

Basically I Have large set of data that to be shown on the grid, i want to bind only sub set of data thru custom pagination otherwise my page will suffer if i have to bind whole data to the grid.

Thanks,
Pavan
Marin
Telerik team
 answered on 09 Oct 2012
1 answer
99 views
Hi,

I have a radgrid on page. which has few textbox conrols, comobox, button etc in grid.
We create row dynamically. Clicking on + sign from grid footer and then it creates a new row.
On new row, we have some input boxes for user to enter info. One os theinput is such that, it has textbox control and button besieds a text box. clicking on button opens a pop up window, user will enter some value in pop window text box, whixh will be passed back from pop up to radgrid textbox control. For existing row it can access the row and textbox control for that row, however for newly created row it throws exception.

Please suggest.

Thanks,
Aditi
Shinu
Top achievements
Rank 2
 answered on 09 Oct 2012
3 answers
184 views
Hi,
I am using Radrotator  control inside modalpopup(using modalpopup extender). But while i am running my project and show modalpopup Radrotator  is not displaying. Normally it is working fine(without modalpopup).
Can you please tell me why it is happening?.
Shinu
Top achievements
Rank 2
 answered on 09 Oct 2012
5 answers
262 views
Hi all,

My MasterTable is defined by:

<MasterTableView DataKeyNames="id">  
    <Columns> 
        <telerik:GridBoundColumn HeaderText="Street" DataField="Address.Street" />                                          
        <telerik:GridBoundColumn HeaderText="HouseNumber" DataField="Address.HouseNumber" /> 
        <telerik:GridBoundColumn HeaderText="ZipCode" DataField="Address.ZipCode.Code" /> 
        <telerik:GridBoundColumn HeaderText="City" DataField="Address.ZipCode.City" /> 
    </Columns> 
</MasterTableView> 

And I want to get the id of the selected item client side. I thought that this would do the trick:

// Javascript  
var selectedItem = $find("MyGridClientID").get_masterTableView().get_selectedItems()[0];  
var selectedItemID = selectedItem.getDataKeyValue("id"); 

But this 'selectedItemID' is following null. What do I do wrong? :o/
Shinu
Top achievements
Rank 2
 answered on 09 Oct 2012
8 answers
340 views
Hi,

I'm creating a grid programmatically based on an unknown number of columns of unknown type and wish to generate multi-line footers with aggregated values. I have looked at the help page, but still not sure how to proceed.

I'm currently working in the RadGrid1_ItemDataBound method where I'm stuck at "if (e.Item is GridFooterItem)". I still need to figure out how to create the footers, populate them with text boxes, and refer to the mysterious clientID mentioned in the help article.
using System;
using System.Data;
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.Text.RegularExpressions;
 
 
public partial class Spreadsheet : System.Web.UI.Page
{
    protected global::System.Web.UI.WebControls.Literal dataRow;
 
    protected void Page_Init(object sender, System.EventArgs e)
    {
        DefineGridStructure();
    }
 
 
    protected void Page_Load(object sender, EventArgs e)
    {
 
        RadGrid grid = (RadGrid)PlaceHolder1.FindControl("RadGrid1");
        RadAjaxManager1.AjaxSettings.AddAjaxSetting(grid, grid);
 
        if (Page.IsPostBack)
        {
            Label1.Text += "Post back!! <br>";
        }
        if (!Page.IsPostBack)
        {
            Label1.Text += "Page_Load; " + DateTime.Now.ToString() + "<br>";
        }
    }
 
    private void DefineGridStructure()
    {
        RadGrid RadGrid1 = new RadGrid();
        RadGrid1.ID = "RadGrid1";
 
        System.Drawing.Color disabledBackColor = System.Drawing.Color.AliceBlue;
        System.Drawing.Color defaultBorderColor = System.Drawing.Color.Black;
 
        RadGrid1.Width = Unit.Percentage(100);
        RadGrid1.PageSize = 7;
        RadGrid1.GridLines = GridLines.Both;
        RadGrid1.AllowPaging = true;
 
        RadGrid1.AllowSorting = true;
        RadGrid1.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;
        RadGrid1.ShowFooter = true;
        RadGrid1.AutoGenerateColumns = false;
        RadGrid1.ShowStatusBar = true;
 
        RadGrid1.DataSourceID = "ObjectDataSource1";
        RadGrid1.ItemDataBound += RadGrid1_ItemDataBound;
 
        RadGrid1.UpdateCommand += RadGrid1_UpdateCommand;
 
        RadGrid1.MasterTableView.PageSize = 7;
        RadGrid1.MasterTableView.Height = Unit.Percentage(100);
        RadGrid1.MasterTableView.DataKeyNames = new string[] { "report_id" };
        RadGrid1.MasterTableView.EditMode = GridEditMode.InPlace;
 
        GridEditCommandColumn editColumn;
        editColumn = new GridEditCommandColumn();
        editColumn.UniqueName = "EditCommandColumn";
        editColumn.ItemStyle.BackColor = disabledBackColor;
        editColumn.ItemStyle.BorderColor = defaultBorderColor;
        editColumn.ItemStyle.BorderWidth = Unit.Pixel(1);
        RadGrid1.MasterTableView.Columns.Add(editColumn);
 
        GridColumnGroup headerGroupColumn;
        GridBoundColumn boundColumn = new GridBoundColumn();
 
        boundColumn.DataField = "report_id";
        boundColumn.HeaderText = "report_id";
        boundColumn.ItemStyle.BackColor = disabledBackColor;
        boundColumn.ItemStyle.BorderColor = defaultBorderColor;
        boundColumn.ItemStyle.BorderWidth = Unit.Pixel(1);
        boundColumn.ReadOnly = true;
        RadGrid1.MasterTableView.Columns.Add(boundColumn);
 
 
        RadGrid1.MasterTableView.AllowMultiColumnSorting = true;
        RadGrid1.MasterTableView.SortExpressions.Clear();
        GridSortExpression expression = new GridSortExpression();
        expression.FieldName = "report_id";
        expression.SortOrder = GridSortOrder.Ascending;
        RadGrid1.MasterTableView.SortExpressions.AddSortExpression(expression);
 
 
 
        DataTable GroupHeaders = WastewaterGrid.GetGroupHeaders();
        DataTable Headers;
 
        foreach (DataRow groupRow in GroupHeaders.Rows)
        {
            String masterGroupName = groupRow["group_name"].ToString();
            String groupColumnHeader = groupRow["group_column_header"].ToString();
 
            Headers = WastewaterGrid.GetHeaders(masterGroupName);
 
            headerGroupColumn = new GridColumnGroup();
            headerGroupColumn.Name = masterGroupName;
            headerGroupColumn.HeaderText = groupColumnHeader;
            RadGrid1.MasterTableView.ColumnGroups.Add(headerGroupColumn);
 
            foreach (DataRow headerRow in Headers.Rows)
            {
                String groupName = headerRow["group_name"].ToString();
                String columnName = headerRow["column_name"].ToString();
                String columnHeader = headerRow["column_header"].ToString();
                String attributeType = headerRow["attribute_type"].ToString();
                String dataType = headerRow["data_type"].ToString();
                String targetValue = headerRow["target_value"].ToString();
 
                if (!groupName.Equals(masterGroupName))
                {
                    continue;
                }
 
                boundColumn = new GridBoundColumn();
                boundColumn.DataField = columnName;
                boundColumn.HeaderText = columnHeader; // where is the uniquename?
                boundColumn.ColumnGroupName = masterGroupName;
 
                if (columnName.Equals("MISDnotes"))
                {
                    boundColumn.ItemStyle.Width = Unit.Percentage(100);
                }
 
                if (!attributeType.Equals("ManualEntry"))
                {
                    boundColumn.ItemStyle.BackColor = disabledBackColor;
                    boundColumn.ReadOnly = true;
                }
 
                RadGrid1.MasterTableView.Columns.Add(boundColumn);
            }
        }
        this.PlaceHolder1.Controls.Add(RadGrid1);
    }
 
 
    public class FooterItem
    {
        private String _columnName;
        private int _count;
        private dynamic _min;
        private dynamic _max;
        private dynamic _sum;
 
        public FooterItem(String str)
        {
            _columnName = str;
            _count = 0;
        }
 
        public String columnName
        {
            get
            {
                return _columnName;
            }
            set
            {
                _columnName = value;
            }
        }
 
        public int count
        {
            get
            {
                return _count;
            }
            set
            {
                _count = value;
            }
        }
 
        public dynamic min
        {
            get
            {
                return _min;
            }
            set
            {
                _min = value;
            }
        }
 
        public dynamic max
        {
            get
            {
                return _max;
            }
            set
            {
                _max = value;
            }
        }
 
        public dynamic sum
        {
            get
            {
                return _sum;
            }
            set
            {
                _sum = value;
            }
        }
 
         
    }
 
 
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        Int32 userRole = 2;
        Int32 today = int.Parse("20110907");
        //String today = DateTime.Today.ToString("yyyyMMdd");
        String columnName;
        String attributeType;
 
        GridTableCell gridCell;
        dynamic cellText;
        Boolean cellPopped = false;
        TextBox cellTextBox;
        Dictionary<String, FooterItem> FooterAggregates = new Dictionary<String, FooterItem>();
        FooterItem footerItem;
 
        DataTable Headers = WastewaterGrid.GetHeaders();
 
        foreach (DataRow row in Headers.Rows)
        {
            columnName = row["column_name"].ToString();
            attributeType = row["attribute_type"].ToString();
 
            if (!attributeType.Contains("varchar"))
            {
                FooterAggregates.Add(columnName, new FooterItem(columnName));
            }
        }
 
 
        if (e.Item is GridDataItem)
        {
            GridDataItem gridRow = (GridDataItem)e.Item;
            Int32 ReportID = int.Parse(gridRow.GetDataKeyValue("report_id").ToString());
            System.Drawing.Color defaultBorderColor = System.Drawing.Color.Black;
            System.Drawing.Color ableBackColor = System.Drawing.Color.White;
            System.Drawing.Color disabledBackColor = System.Drawing.Color.AliceBlue;
            System.Drawing.Color ableBorderColor = System.Drawing.Color.Lime;
 
            foreach (DataRow row in Headers.Rows)
            {
                columnName = row["column_name"].ToString();
                attributeType = row["attribute_type"].ToString();
                 
                gridCell = (GridTableCell)gridRow[columnName];
                //cellText = gridCell.Text;
                cellText = ((DataRowView)gridRow.DataItem)[columnName];
 
                cellPopped = !String.IsNullOrEmpty((String)cellText);
 
                if (cellPopped)
                {
                    footerItem = FooterAggregates[columnName];
 
                    footerItem.count += 1;
 
                    if (footerItem.min == null)
                    {
                        footerItem.min = cellText;
                    }
                    else
                    {
                        if (footerItem.min > cellText)
                        {
                            footerItem.min = cellText;
                        }
                    }
 
                    if (footerItem.max == null)
                    {
                        footerItem.max = cellText;
                    }
                    else
                    {
                        if (footerItem.max < cellText)
                        {
                            footerItem.max = cellText;
                        }
                    }
 
                    if (footerItem.sum == null)
                    {
                        footerItem.sum = cellText;
                    }
                    else
                    {
                        footerItem.sum += cellText;
                    }
                }
                     
                gridCell.BorderColor = defaultBorderColor;
                gridCell.BorderWidth = Unit.Pixel(1);
 
                if (userRole == 1)
                {
 
                    if (attributeType.Equals("ManualEntry"))
                    {
                        gridCell.BackColor = ableBackColor;
                        gridCell.BorderColor = ableBorderColor;
                    }
                }
                else
                {
                    if (attributeType.Equals("ManualEntry"))
                    {
                        if (!ReportID.Equals(today))
                        {
                            if (String.IsNullOrEmpty(cellText))
                            {
                                gridCell.BackColor = ableBackColor;
                                gridCell.BorderColor = ableBorderColor;
                            }
                            else
                            {
                                gridCell.BackColor = disabledBackColor;
                            }
                        }
                        else
                        {
                            gridCell.BackColor = ableBackColor;
                            gridCell.BorderColor = ableBorderColor;
                        }
                    }
 
                    if (e.Item.IsInEditMode && !ReportID.Equals(today) && cellPopped)
                    {
                        cellTextBox = (TextBox)gridCell.Controls[0];
                        cellTextBox.BorderStyle = BorderStyle.None;
                        cellTextBox.BackColor = disabledBackColor;
                        cellTextBox.ReadOnly = true;
 
                        //Label1.Text += "EditMode::ReportID=" + ReportID + "columnName=" + columnName + "::cellText=" + cellText + " <br>";
                    }
                }
            }
        }
 
        if (e.Item is GridFooterItem)
        {
            GridFooterItem gridRow = (GridFooterItem)e.Item;
            int count = 0;
            dynamic min;
            dynamic max;
            dynamic sum;
 
            foreach (DataRow row in Headers.Rows)
            {
                columnName = row["column_name"].ToString();
                attributeType = row["attribute_type"].ToString();
 
                gridCell = (GridTableCell)gridRow[columnName];
                //cellText = gridCell.Text;
                cellText = ((DataRowView)gridRow.DataItem)[columnName];
 
                footerItem = FooterAggregates[columnName];
 
                count += footerItem.count;
 
            }
        }
    }
 
 
 
 
 
    private void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e)
    {
        Label1.Text += " Table to be updated: " + e.Item.OwnerTableView.DataMember + "<br>";
 
        GridEditableItem editedItem = e.Item as GridEditableItem;
        GridEditManager editMan = editedItem.EditManager;
 
        Int32 ReportID = int.Parse(editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["report_id"].ToString());
        String Login = "David-T420s\\davidk";
 
        foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
        {
            if (column.UniqueName.Equals("report_id"))
            {
                continue;
            }
 
            if (column is IGridEditableColumn)
            {
                Boolean isEditable = column.IsEditable;
                String editColumnName = column.UniqueName.ToString();
                String ResultString;
 
                IGridEditableColumn editableCol = (column as IGridEditableColumn);
                if (editableCol.IsEditable)
                {
                    IGridColumnEditor editor = editMan.GetColumnEditor(editableCol);
 
                    if (editor is GridTextColumnEditor)
                    {
                        String Datum = (editor as GridTextColumnEditor).Text.Trim();
 
                        DataTable Headers = WastewaterGrid.GetHeaders();
                        foreach (DataRow row in Headers.Rows)
                        {
                            String columnName = row["column_name"].ToString();
                            String dataType = row["data_type"].ToString();
 
                            if (columnName.Equals(editColumnName))
                            {
                                ResultString = ValidateUserInput(dataType, Datum);
                                if (!ResultString.Equals("valid"))
                                {
                                    RadAjaxManager1.Alert(ResultString);
 
                                    e.Canceled = true;
                                    break;
                                }
                                else
                                {
                                    try
                                    {
                                        WastewaterGrid.UpsertDatum(ReportID, editColumnName, Datum, Login);
                                    }
                                    catch (Exception ex)
                                    {
                                        Label1.Text += "<strong>Unable to set value of column '" + column.UniqueName + "'</strong>  <br>" + ex.Message;
                                        RadAjaxManager1.Alert("Unable to set value of column: " + column.UniqueName + "; " + ex.Message);
                                        e.Canceled = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
 
        try
        {
            WastewaterGrid.ReCalculate(ReportID);
        }
        catch (Exception ex)
        {
            RadAjaxManager1.Alert("Unable to run ReCalculate: " + ex.Message);
            e.Canceled = true;
        }
    }
 
     
     
    private String ValidateUserInput(String dataType, String Datum)
    {
        if (String.IsNullOrEmpty(Datum))
        {
            return "valid";
        }
 
        Match match;
        String ResultString;
        String TestString;
        Int32 stringLength = Datum.Length;
 
        String IntPattern = @"^\d+$";
        RadAjaxManager1.Alert("VALIDATEUSERINPUT: dataType=\"" + dataType + "\"; Datum=\"" + Datum + "\"");
 
        switch (dataType)
        {
            case "bigint":
                match = Regex.Match(Datum, IntPattern);
                if (match.Success)
                {
                    try
                    {
                        TestString = Int64.Parse(Datum).ToString();
                    }
                    catch (OverflowException)
                    {
                        return "Overflow Exception: improper " + dataType + "format in \"" + Datum + "\"";
                    }
                }
                else
                {
                    return "Improper format: Int64";
                }
                break;
 
            case "decimal(10,2)":
                ResultString = ValidateDecimalFormat(dataType, Datum, stringLength, 10, 2);
                if (!ResultString.Equals("valid"))
                {
                    return ResultString;
                }
                else
                {
                    try
                    {
                        TestString = Decimal.Parse(Datum).ToString();
                    }
                    catch (OverflowException)
                    {
                        return "Overflow Exception: improper " + dataType + "format in \"" + Datum + "\"";
                    }
                }
                break;
            case "decimal(10,3)":
                ResultString = ValidateDecimalFormat(dataType, Datum, stringLength, 10, 3);
                if (!ResultString.Equals("valid"))
                {
                    return ResultString;
                }
                else
                {
                    try
                    {
                        TestString = Decimal.Parse(Datum).ToString();
                    }
                    catch (OverflowException)
                    {
                        return "Overflow Exception: improper " + dataType + "format in \"" + Datum + "\"";
                    }
                }
                break;
            case "decimal(4,1)":
                ResultString = ValidateDecimalFormat(dataType, Datum, stringLength, 4, 1);
                if (!ResultString.Equals("valid"))
                {
                    return ResultString;
                }
                else
                {
                    try
                    {
                        TestString = Decimal.Parse(Datum).ToString();
                    }
                    catch (OverflowException)
                    {
                        return "Overflow Exception: improper " + dataType + "format in \"" + Datum + "\"";
                    }
                }
                break;
            case "decimal(5,1)":
                ResultString = ValidateDecimalFormat(dataType, Datum, stringLength, 5, 1);
                if (!ResultString.Equals("valid"))
                {
                    return ResultString;
                }
                else
                {
                    try
                    {
                        TestString = Decimal.Parse(Datum).ToString();
                    }
                    catch (OverflowException)
                    {
                        return "Overflow Exception: improper " + dataType + "format in \"" + Datum + "\"";
                    }
                }
                break;
            case "decimal(6,1)":
                ResultString = ValidateDecimalFormat(dataType, Datum, stringLength, 6, 1);
                if (!ResultString.Equals("valid"))
                {
                    return ResultString;
                }
                else
                {
                    try
                    {
                        TestString = Decimal.Parse(Datum).ToString();
                    }
                    catch (OverflowException)
                    {
                        return "Overflow Exception: improper " + dataType + "format in \"" + Datum + "\"";
                    }
                }
                break;
            case "int":
                match = Regex.Match(Datum, IntPattern);
                if (match.Success)
                {
                    try
                    {
                        TestString = Int32.Parse(Datum).ToString();
                        //throw new CustomExceptions.
                    }
                    catch (OverflowException)
                    {
                        return "Overflow Exception: improper " + dataType + "format in \"" + Datum + "\"";
                    }
                }
                else
                {
                    return "Improper format: Int32";
                }
                break;
            case "varchar(25)":
                if (stringLength > 25)
                {
                    return "Improper " + dataType + "format in \"" + Datum + "\"";
                }
                break;
 
            case "varchar(255)":
                if (stringLength > 255)
                {
                    return "Improper " + dataType + "format in \"" + Datum + "\"";
                }
                break;
            default:
                RadAjaxManager1.Alert("Unhandled data type");
                return "Unhandled data type: \"" + dataType + "\"";
        }
        return "valid";
    }
 
    private String ValidateDecimalFormat(String dataType, String Datum, int stringLength, int precision, int scale)
    {
        Match match;
        String IntPattern = @"^\d+$";
        String ResultString;
        Int32 decimalIndex = Datum.IndexOf(".");
 
        if (decimalIndex > 0)
        {
            Int32 fractionalLength = stringLength - decimalIndex - 1;
 
            if (fractionalLength > scale)
            {
                return "Improper " + dataType + "format in \"" + Datum + "\"";
            }
 
            Int32 integralLength = stringLength - fractionalLength - 1;
 
            if (integralLength > (precision - scale))
            {
                return "Improper " + dataType + "format in \"" + Datum + "\"";
            }
 
            String integralString = Datum.Substring(0, decimalIndex);
            String fractionalString = Datum.Substring(decimalIndex + 1, fractionalLength);
            match = Regex.Match(integralString, IntPattern);
            if (match.Success)
            {
                match = Regex.Match(fractionalString, IntPattern);
                if (match.Success)
                {
                    ResultString = "valid";
                }
                else
                {
                    ResultString = "Improper " + dataType + "format in \"" + Datum + "\"";
                }
            }
            else
            {
                ResultString = "Improper " + dataType + "format in \"" + Datum + "\"";
            }
 
        }
        else if (stringLength > (precision - scale))
        {
            ResultString = "Improper " + dataType + "format in \"" + Datum + "\"";
        }
        else
        {
            match = Regex.Match(Datum, IntPattern);
            if (match.Success)
            {
                ResultString = "valid";
            }
            else
            {
                ResultString = "Improper " + dataType + "format in \"" + Datum + "\"";
            }
        }
 
        return ResultString;
    }
}


Thanks,
David
David
Top achievements
Rank 1
 answered on 08 Oct 2012
3 answers
346 views
Hi 

I have a RadGrid on my aspx page with no columns defined as follows:

    <telerik:RadGrid ID="RadGrid1" runat="server" AllowMultiRowSelection="True" Skin="Metro"
        GroupingEnabled="true" ShowGroupPanel="True" GridLines="None" EnableLinqExpressions="false">
        <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true">
            <Excel Format="ExcelML" />
        </ExportSettings>
        <MasterTableView TableLayout="Fixed" AutoGenerateColumns="true" Width="100%" CommandItemDisplay="Top"
            AllowMultiColumnSorting="True" GroupLoadMode="Server" ShowGroupFooter="true"
            AllowSorting="True" AllowPaging="True" PageSize="20" ShowFooter="false" HeaderStyle-HorizontalAlign="left"
            FooterStyle-HorizontalAlign="Right" EnableHeaderContextMenu="true" EnableHeaderContextAggregatesMenu="true"
            AllowFilteringByColumn="True" HeaderStyle-BackColor="Black" HeaderStyle-ForeColor="White">
            <CommandItemSettings ShowExportToExcelButton="true" />
            <NoRecordsTemplate>
                <div class="NoRecordsTemplate">
                    No records to view</div>
            </NoRecordsTemplate>
        </MasterTableView>
        <ClientSettings AllowDragToGroup="true" EnableRowHoverStyle="true" AllowColumnsReorder="true"
            ReorderColumnsOnClient="true">
            <Selecting AllowRowSelect="True"></Selecting>
            <Resizing AllowResizeToFit="true" AllowColumnResize="True" EnableRealTimeResize="True">
            </Resizing>
        </ClientSettings>
        <GroupingSettings CaseSensitive="false" ShowUnGroupButton="True" RetainGroupFootersVisibility="true" />
        <PagerStyle Mode="NextPrevNumericAndAdvanced" />
    </telerik:RadGrid> 

On my code-behind page I populate the RadGrid using the GetDataTable function as follows:

    Public Function GetDataTable(ByVal query As String) As DataTable
        Dim ConnString As String = ConfigurationManager.ConnectionStrings("SQLConn").ConnectionString
        Dim conn As SqlConnection = New SqlConnection(ConnString)
        Dim adapter As SqlDataAdapter = New SqlDataAdapter
        adapter.SelectCommand = New SqlCommand(query, conn)
        Dim table1 As New DataTable
        conn.Open()
        Try
            adapter.Fill(table1)
        Finally
            conn.Close()
        End Try
        Return table1
    End Function

What I am trying to do is hide the filter icon, set AutoPostBackOnFilter=True and set filter width to auto fit programmatically.

I was able to hide the filter icon by using the following:
    <style>
        .RadGrid .rgFilter
        {
            display: none;
        }
    </style>

However, I can't figure how to set AutoPostBackOnFilter=True and set filter width to auto fit programmatically.

How can I accomplish this?

Thanks,

Sigi Perez

 
Sigifredo
Top achievements
Rank 1
 answered on 08 Oct 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?