Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
552 views
Is it possible to pass a parameter to

RadGrid.NeedDataSource += new GridNeedDataSourceEventHandler(grid_NeedDataSource(Parameter i want to pass));

  void grid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e, DataTable dt)
    {
        DataTable current = dt;
        RadGrid grid = (RadGrid)sender;
        grid.DataSource = current;
    }

I want to be able to pass it a DataTable as a parameter. How would i be able to do that?
Jayesh Goyani
Top achievements
Rank 2
 answered on 26 Sep 2013
1 answer
407 views
Hello,
I use Radgrid for viewing my web application logs. These logs has 7 different types, so in order to filter the grid, I added before radgrid, a CheckBoxList that contains the ID of log types. So the code is something like this:

       For Each lItem As ListItem In chkTipologieLog.Items
            If lItem.Selected Then
                lstrFiltro += "(CodTipologiaLog = " + lItem.Value.ToString + ") OR"
            End If
        Next
 
           rdgrid.Mastertableview.FilterExpression = "(" + lstrFiltro + ")"
           rdgrid.Mastertableview.rebind

The code is more than this one, it consider also the filter operations made by radgrid filter columns, so, in checbox select index changed, the rdgrid.Mastertableview.FilterExpression could be like this:
"(iif(Azienda == null, "", Azienda).ToString().ToUpper() = "Azienda 1".ToUpper()) AND ((CodTipologiaLog = 2) OR(CodTipologiaLog = 3))"

It perfectly works if you choose a filter in the filterrow (in this case Azienda = Azienda 1) and THEN you select one or more items in checlistbox.

BUT... if you select one checkbox and then you choose a filter in the filter-row, the filters programmatically created is not taken in consideration. I tried to catch ItemCommand event of radgrid and, when FilterCommandName is fired, recalculate the filters obtained by checboxes. In this case, even if filterexpression contains the correct query, rows are filtered only for Azienda = Azienda 1 query.

The same if I recaculate the filter on every postback.

Where am I wrong?

Thanks
Mario
Konstantin Dikov
Telerik team
 answered on 26 Sep 2013
3 answers
276 views
Hi,

I have searched high and low for a solution to this problem, but haven't been able to find answer as yet.

I am trying to fix a bug in an existing application.  There is a grid with a column of text-boxes that the user can enter data into.  The column is made editable in the grid PreRender event.

Here is the code:

 
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
    <telerik:RadGrid ID="TGrid" runat="server" Visible="true" AllowPaging="true" AllowSorting="true"
        PageSize="20" ScrollHeight="100px" ViewStateMode="Enabled" OnNeedDataSource="RadGrid1_NeedDataSource"
        OnPreRender="RadGrid1_PreRender" AutoGenerateColumns="false" AllowSelection="False"
        AllowMultiRowSelection="false" AllowMultiRowEdit="true" >
        <MasterTableView runat="server" HeaderStyle-Wrap="False" AllowCustomSorting="true"
            AllowMultiColumnSorting="false" RetrieveAllDataFields="false" EnableColumnsViewState="false"
            EditFormSettings-EditColumn-Visible="false" AdditionalDataFieldNames="Cow_ID"
            DataKeyNames="Cow_ID" EditMode="InPlace">
            <Columns>
                <telerik:GridBoundColumn DataField="Cow_ID" HeaderText="MiHub ID" DataType="System.Int32"
                    ReadOnly="true" HeaderStyle-Width="6em" />
                <telerik:GridBoundColumn DataField="COW_EID" HeaderText="Electronic ID" DataType="System.String"
                    ReadOnly="true" HeaderStyle-Width="12em" />
                <telerik:GridBoundColumn DataField="COW_LifeId" HeaderText="Birth ID" DataType="System.String"
                    ReadOnly="true" HeaderStyle-Width="8em" />
                <telerik:GridBoundColumn DataField="COW_VID" HeaderText="Current Visual ID" DataType="System.Int32"
                    ReadOnly="true" HeaderStyle-Width="8em" />
                <telerik:GridTemplateColumn DataField="COW_VID" HeaderText="New Visual ID" DataType="System.Int32"
                    ReadOnly="false" HeaderStyle-Width="15em">
                    <EditItemTemplate>
                        <telerik:RadNumericTextBox runat="server" ID="tbNewVisualID" SelectionOnFocus="SelectAll"
                            AutoPostBack="false" MinValue="0" MaxValue="999999">
                            <NumberFormat DecimalDigits="0" GroupSeparator="" />
                            <ClientEvents OnKeyPress="TelerikVisualIDKeyPress" OnValueChanged="TelerikValueChanged" />
                        </telerik:RadNumericTextBox>
                        <span class="errorText" style="display: none">*NOT UNIQUE*</span>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
</div>


public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
 
    protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
 
        var data = new List<object>();
        for (int i = 0; i < 1000; i++)
        {
            data.Add(new {Cow_Id = i, Cow_EID = i,cow_LifeId = i, Cow_VID = i});
        }
 
        TGrid.DataSource = data;
 
    }
 
    protected void RadGrid1_PreRender(object sender, EventArgs e)
    {
        foreach (GridItem item in TGrid.MasterTableView.Items)
        {
            if (item is GridEditableItem)
            {
                GridEditableItem editableItem = item as GridDataItem;
                editableItem.Edit = true;
            }
        }
        TGrid.Rebind();           
    }
}

Running the code shows the editable column correctly, however changing the page size doesn't work as expected.  Paging however seems to work fine.

If I comment out  TGrid.Rebind();, or editableItem.Edit = true; then changing the page size works as expected, but then the column is not editable.  Any thoughts?

Thanks in advance.
Jayesh Goyani
Top achievements
Rank 2
 answered on 26 Sep 2013
1 answer
78 views
Hello,

I work on a Grid and use .Aggregate() and .CellAction() (for cell.HtmlAttributes["style"]). 

Everything works except when I rebind the grid on the client-side (after edit, delete, etc.). I lost my aggregations and all my cells style too. How can I keep this parameters during a rebind ?

Here is my grid :
   
@{
Html.Telerik().Grid(Model)
           .Name("Grid")
           .DataBinding(dataBinding =>
           {
               dataBinding.Ajax()
                   .Select("Select", "MyController")
                   .Insert("Insert", "MyController")
                   .Update("Update", "MyController")
                   .Delete("Delete", "MyController");
           })
           .ClientEvents(events => events
               .OnDataBinding("onDataBinding")
               .OnComplete("onComplete")
               .OnEdit("onEdit")
               .OnRowDataBound("onRowDataBound"))
           .Columns(columns =>
           {
               columns.Command(commands =>
               {
                   commands.Edit().ButtonType(GridButtonType.Image);
                   commands.Delete().ButtonType(GridButtonType.Image);
               }).Width(30); ;
               columns.Bound(o => o.Id);
               columns.Bound(o => o.col1);
                   .Aggregate(aggregates => aggregates.Sum())
                   .GroupFooterTemplate(@<text>@item.Sum</text>);
               columns.Bound(o => o.col2)
                   .Aggregate(aggregates => aggregates.Sum())
                   .GroupFooterTemplate(@<text>@item.Sum</text>);
               columns.Bound(o => o.col3)
                   .Aggregate(aggregates => aggregates.Sum())
                   .GroupFooterTemplate(@<text>@item.Sum</text>);
               
           })
           .CellAction(cell =>
           {
               if ((cell.Column.Member == "col1")
               {
                   cell.HtmlAttributes["style"] = "background-color: red";
               }
           })
           .Sortable(sorting => sorting
               .SortMode(GridSortMode.MultipleColumn)
           )
           .Filterable()
           .Render();
   }
}

Thank in advance for your help,

Alexandre G.
Eyup
Telerik team
 answered on 26 Sep 2013
1 answer
341 views
Hi Team,

We upgraded Telerik version from 2012 to 2013.After migration,All "webmethods" calls are failling.we are getting "Authentication Failed" error.The same code is working fine in Telerik version 2012.Our Implementaion is as follows,

In Class1.cs

[WebMethod(enablesession="true")]
Public static string Test(String s)
{
return "Sucess";
}

In Aspx
    function OnSuccess(response)
     {
           alert
(response);
     
}
    function OnError(error) 
    {
          alert
(error);
    }
    function CallTest() 
    {
        PageMethods.Test("sample",OnSuccess, OnError);
    }

Incase someone has faced a similar issue and fixed it,Could you please share the steps/settings  what you have done for fixing this issue.

Thanks in advance,
Raj
Shinu
Top achievements
Rank 2
 answered on 26 Sep 2013
1 answer
105 views
Hello,

My site wasn't applying Skins.

UPDATE:
I just found that my site doesn't include following css references. A different sample site I made, however, does include this.

I can't find where and how this gets included as I fail to find any difference between the codes/libraries in my working and non working websites.


This is the code that isn't generated in the faulty site: I have also added an image of this code if it helps.
<head>
<link href="/WebSite1/WebResource.axd?d=0i1mhVJ1-dCV5bBQXa0WNXmbYGESRkFTq4w1-p04ECHlsK4EoLUX1v8K-ZEziSa6NLLuG8CQam_hjdn0a-QT8ONr_XN7EfGhnC1BbK_yM-K8wo4J3O3HvSi491O8V-ldsembv4hJx1QV2zWuP_rnWQ2&amp;t=635095910640000000" type="text/css" rel="stylesheet" class="Telerik_stylesheet" /> <link href="/WebSite1/WebResource.axd?d=TmmFO1tq-7uTu5j8SekrhtT8osQVDICIU-WZILvwTtp5huwNHWvgSDpEn1MLG9QybLXZ6_uafB0lE_k2xCKvNKCoWQcyDqsJlB1Q6bZ_zeIiLH_L1HAe1W8TBdRZsDvJfNNOsOjyqep5yJauApJnsBJ3hh1SdpYZo_dmjWVp0zg1&amp;t=635095910640000000" type="text/css" rel="stylesheet" class="Telerik_stylesheet" /> </head>

I have a radgrid that is supposed to be styles according to an embedded skin.

1 - I have added the matching version of the Telerik.web....UI.skins.dll to my bin
2 - I referenced the file
3 - I can see all skins in the "design" mode. I can select a skin and the grid even get those colours (in the design mode)
4 - But at run time, the grid gets data but is displayed as a very raw HTML table.
(Please see attached)

5 - I created a similar grid (using same settings and same methods to populate) for a different website and that works fine! so my referencing must be correct.

My project uses many css files. 

So is it possible to override skins by one of those files accidentally?

If so, what should I do?

Is there a way to find it out please?

Please help...

Kind Regards,
Menol

Grid component control code:

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<DataDriven.Rooster.UI.Models.TGridComponentModel>" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    <Scripts>
        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
    </Scripts>
</telerik:RadScriptManager>
<div id="TGrid">
    <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" 
        CellSpacing="0" Skin="Glow"
        OnNeedDataSource="Model.PopulateGridOn_NeedDataSource" 
        OnItemDataBound="Model.RadGrid1_ItemDataBound" 
        OnPreRender="Model.RadGrid1_PreRender1" AutoGenerateColumns="False">
    </telerik:RadGrid>
</div>
Venelin
Telerik team
 answered on 26 Sep 2013
2 answers
273 views
I am trying to create a class that will allow me to create a radgrid dynamically. Then i have it load on page_load or page_init and i get the same problem. It creates the grid no problem, but when i click on delete, it deletes one record, and then if i click on delete again, it just refreshes the page and nothing happens. Also if i click on insert, it will insert one record and that's it, and then if i try to insert another record, the last record inserted gets deleted.

Class File (invoicer.cs)
public class invoicer
{
    public invoicer()
    {
        //
        // TODO: Add constructor logic here
        //
 
        string currentSession = HttpContext.Current.Session.SessionID;
        DataTable dt = GetTable();
        HttpContext.Current.Session.Add(currentSession, dt);
         
    }
 
    public class MyTemplate : ITemplate
    {
        private string colname;
        protected Label lControl;
        public MyTemplate(string cName)
        {
            colname = cName;
        }
        public void InstantiateIn(System.Web.UI.Control container)
        {
            lControl = new Label();
            lControl.ID = "Label-DurationType";
            lControl.DataBinding += new EventHandler(lControl_DataBinding);
            container.Controls.Add(lControl);
        }
 
        public void lControl_DataBinding(object sender, EventArgs e)
        {
            Label l = (Label)sender;
            GridDataItem container = (GridDataItem)l.NamingContainer;
            l.Text = ((DataRowView)container.DataItem)[colname].ToString() + "<br />";
        }
    }
 
 
    public class MyEditTemplate : IBindableTemplate
    {
        public void InstantiateIn(Control container)
        {
            GridDataItem item = ((GridDataItem)(container.NamingContainer));
            DropDownList drop = new DropDownList();
            drop.ID = "DurationType-DDL";
            drop.DataSource = (DataTable)GetTableForDropDown();
            drop.DataTextField = "DurationType";
            drop.DataValueField = "DurationType";
 
            container.Controls.Add(drop);
        }
        public System.Collections.Specialized.IOrderedDictionary ExtractValues(System.Web.UI.Control container)
        {
            OrderedDictionary od = new OrderedDictionary();
            od.Add("DurationType", ((DropDownList)(((GridDataItem)(container)).FindControl("DurationType-DDL"))).DataValueField);
            return od;
        }
    }
 
    protected void grid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
        {
            GridEditFormItem editItem = (GridEditFormItem)e.Item;
            DropDownList ddl = (DropDownList)editItem.FindControl("DurationType-DDL");
            ddl.DataSource = (DataTable)GetTableForDropDown();
            ddl.DataTextField = "DurationType";
            ddl.DataValueField = "DurationType";
            ddl.SelectedIndex = editItem.ItemIndex;
        }
    }
 
 
 
    public void DefineGridStructure(int i, PlaceHolder ph)
    {
        RadGrid grid = new RadGrid();
        grid.ID = "RadGrid" + i.ToString();
        grid.NeedDataSource += new GridNeedDataSourceEventHandler(grid_NeedDataSource);
        grid.AutoGenerateEditColumn = true;
        grid.AutoGenerateDeleteColumn = true;
        grid.AllowAutomaticInserts = false;
        grid.Width = Unit.Percentage(100);
        grid.PageSize = 15;
        grid.AllowPaging = true;
        grid.AllowFilteringByColumn = true;
        grid.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;
        grid.AutoGenerateColumns = false;
        grid.MasterTableView.Width = Unit.Percentage(100);
        grid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.TopAndBottom;
        grid.AllowAutomaticDeletes = false;
        grid.AllowAutomaticUpdates = false;
        grid.ItemDataBound += new GridItemEventHandler(grid_ItemDataBound);
        grid.InsertCommand += grid_InsertCommand;
        grid.DeleteCommand += grid_DeleteCommand;
        grid.UpdateCommand += grid_UpdateCommand;
        grid.MasterTableView.DataKeyNames = new string[] { "RowNumber" };
        GridBoundColumn boundColumn = new GridBoundColumn();
        boundColumn.DataField = "RowNumber";
        boundColumn.HeaderText = "RowNumber";
        boundColumn.ReadOnly = true;
        grid.MasterTableView.Columns.Add(boundColumn);
        boundColumn = new GridBoundColumn();
        boundColumn.DataField = "Size";
        boundColumn.HeaderText = "Size";
        grid.MasterTableView.Columns.Add(boundColumn);
        boundColumn = new GridBoundColumn();
        boundColumn.DataField = "Description";
        boundColumn.HeaderText = "Description";
        grid.MasterTableView.Columns.Add(boundColumn);
        boundColumn = new GridBoundColumn();
        boundColumn.DataField = "Quantity";
        boundColumn.HeaderText = "Quantity";
        grid.MasterTableView.Columns.Add(boundColumn);
        boundColumn = new GridBoundColumn();
        boundColumn.DataField = "Unit";
        boundColumn.HeaderText = "Unit";
        grid.MasterTableView.Columns.Add(boundColumn);
        boundColumn = new GridBoundColumn();
        boundColumn.DataField = "Duration";
        boundColumn.HeaderText = "Duration";
        grid.MasterTableView.Columns.Add(boundColumn);
 
        GridTemplateColumn objGridTemplateColumn = new GridTemplateColumn();
        objGridTemplateColumn.HeaderText = "DurationType";
        objGridTemplateColumn.DataField = "DurationType";
        objGridTemplateColumn.ItemTemplate = new MyTemplate("DurationType");
        objGridTemplateColumn.EditItemTemplate = new MyEditTemplate();
        grid.MasterTableView.Columns.Add(objGridTemplateColumn);
 
        boundColumn = new GridBoundColumn();
        boundColumn.DataField = "Amount";
        boundColumn.HeaderText = "Amount";
        grid.MasterTableView.Columns.Add(boundColumn);
        grid.MasterTableView.EditMode = GridEditMode.InPlace;
        ph.Controls.Add(grid);
    }
 
 
    public void grid_UpdateCommand(object sender, GridCommandEventArgs e)
    {
        GridEditableItem editItem = e.Item as GridEditableItem;
        Hashtable newValues = new Hashtable();
        newValues["RowNumber"] = (editItem["RowNumber"].Controls[0] as TextBox).Text;
        newValues["Size"] = (editItem["Size"].Controls[0] as TextBox).Text;
        newValues["Description"] = (editItem["Description"].Controls[0] as TextBox).Text;
        newValues["Quantity"] = (editItem["Quantity"].Controls[0] as TextBox).Text;
        newValues["Unit"] = (editItem["Unit"].Controls[0] as TextBox).Text;
        newValues["Duration"] = (editItem["Duration"].Controls[0] as TextBox).Text;
        newValues["DurationType"] = (editItem.FindControl("DurationType-DDL") as DropDownList).SelectedValue;
        newValues["Amount"] = (editItem["Amount"].Controls[0] as TextBox).Text;
        DataTable dtCurrentTable = (DataTable)HttpContext.Current.Session[HttpContext.Current.Session.SessionID];
        foreach (DictionaryEntry entry in newValues)
        {
            dtCurrentTable.Rows[e.Item.ItemIndex][entry.Key.ToString()] = entry.Value;
        }
    }
 
 
    public void grid_DeleteCommand(object sender, GridCommandEventArgs e)
    {
        GridDataItem item = e.Item as GridDataItem;
        DataTable dt = (DataTable)HttpContext.Current.Session[HttpContext.Current.Session.SessionID];
        dt.Rows.Remove(dt.Rows[item.ItemIndex]);
        ResetRowID(dt);
    }
 
    public void grid_InsertCommand(object sender, GridCommandEventArgs e)
    {
        GridEditableItem editedItem = e.Item as GridEditableItem;
        GridEditManager editMan = editedItem.EditManager;
        //Set new values
        Hashtable newValues = new Hashtable();
        //The GridTableView will fill the values from all editable columns in the hash
 
        DataTable dtCurrentTable = (DataTable)HttpContext.Current.Session[HttpContext.Current.Session.SessionID];
        DataRow dr = null;
        int count = dtCurrentTable.Rows.Count;
        count++;
        dr = dtCurrentTable.NewRow();
        dr["RowNumber"] = count;
        newValues["RowNumber"] = count;
        newValues["Size"] = (editedItem["Size"].Controls[0] as TextBox).Text;
        newValues["Description"] = (editedItem["Description"].Controls[0] as TextBox).Text;
        newValues["Quantity"] = (editedItem["Quantity"].Controls[0] as TextBox).Text;
        newValues["Unit"] = (editedItem["Unit"].Controls[0] as TextBox).Text;
        newValues["Duration"] = (editedItem["Duration"].Controls[0] as TextBox).Text;
        newValues["DurationType"] = (editedItem.FindControl("DurationType-DDL") as DropDownList).SelectedValue;
        newValues["Amount"] = (editedItem["Amount"].Controls[0] as TextBox).Text;
        foreach (DictionaryEntry entry in newValues)
        {
            dr[entry.Key.ToString()] = entry.Value;
        }
        dtCurrentTable.Rows.Add(dr);
    }
 
    void grid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        DataTable current = (DataTable)HttpContext.Current.Session[HttpContext.Current.Session.SessionID];
        RadGrid grid = (RadGrid)sender;
        grid.DataSource = current;
    }
 
 
    static DataTable GetTable()
    {
        //
        // Here we create a DataTable with a few columns.
        //
        // Create Datatable to store all colums
        DataTable dt = new DataTable();
        DataRow dr = null;
        dt.Columns.Add(new DataColumn("RowNumber", typeof(string)));
        dt.Columns.Add(new DataColumn("Size", typeof(string)));
        dt.Columns.Add(new DataColumn("Description", typeof(string)));
        dt.Columns.Add(new DataColumn("Quantity", typeof(string)));
        dt.Columns.Add(new DataColumn("Unit", typeof(string)));
        dt.Columns.Add(new DataColumn("Duration", typeof(string)));
        dt.Columns.Add(new DataColumn("DurationType", typeof(string)));
        dt.Columns.Add(new DataColumn("Amount", typeof(string)));
        dr = dt.NewRow();
        dr["RowNumber"] = 1;
        dr["Size"] = string.Empty;
        dr["Description"] = string.Empty;
        dr["Quantity"] = string.Empty;
        dr["Unit"] = string.Empty;
        dr["Duration"] = string.Empty;
        dr["DurationType"] = string.Empty;
        dr["Amount"] = string.Empty;
        dt.Rows.Add(dr);
 
        dr = dt.NewRow();
        dr["RowNumber"] = 2;
        dr["Size"] = string.Empty;
        dr["Description"] = string.Empty;
        dr["Quantity"] = string.Empty;
        dr["Unit"] = string.Empty;
        dr["Duration"] = string.Empty;
        dr["DurationType"] = string.Empty;
        dr["Amount"] = string.Empty;
        dt.Rows.Add(dr);
 
        dr = dt.NewRow();
        dr["RowNumber"] = 3;
        dr["Size"] = string.Empty;
        dr["Description"] = string.Empty;
        dr["Quantity"] = string.Empty;
        dr["Unit"] = string.Empty;
        dr["Duration"] = string.Empty;
        dr["DurationType"] = string.Empty;
        dr["Amount"] = string.Empty;
        dt.Rows.Add(dr);
 
        dr = dt.NewRow();
        dr["RowNumber"] = 4;
        dr["Size"] = string.Empty;
        dr["Description"] = string.Empty;
        dr["Quantity"] = string.Empty;
        dr["Unit"] = string.Empty;
        dr["Duration"] = string.Empty;
        dr["DurationType"] = string.Empty;
        dr["Amount"] = string.Empty;
        dt.Rows.Add(dr);
 
        dr = dt.NewRow();
        dr["RowNumber"] = 5;
        dr["Size"] = string.Empty;
        dr["Description"] = string.Empty;
        dr["Quantity"] = string.Empty;
        dr["Unit"] = string.Empty;
        dr["Duration"] = string.Empty;
        dr["DurationType"] = string.Empty;
        dr["Amount"] = string.Empty;
        dt.Rows.Add(dr);
        return dt;
    }
 
    static DataTable GetTableForDropDown()
    {
        //
        // Here we create a DataTable with a few columns.
        //
        // Create Datatable to store all colums
        DataTable dt = new DataTable();
        DataRow dr = null;
        dt.Columns.Add(new DataColumn("DurationType", typeof(string)));
 
        dr = dt.NewRow();
        dr["DurationType"] = "Hours";
        dt.Rows.Add(dr);
 
        dr = dt.NewRow();
        dr["DurationType"] = "Days";
        dt.Rows.Add(dr);
 
        dr = dt.NewRow();
        dr["DurationType"] = "Weeks";
        dt.Rows.Add(dr);
 
        dr = dt.NewRow();
        dr["DurationType"] = "Months";
        dt.Rows.Add(dr);
        return dt;
    }
 
    private void ResetRowID(DataTable dt)
    {
        int rowNumber = 1;
 
        if (dt.Rows.Count > 0)
        {
            foreach (DataRow row in dt.Rows)
            {
                row[0] = rowNumber;
                rowNumber++;
            }
        }
    }
 
}




I try to add it to the default.aspx,cs page

public partial class Default : System.Web.UI.Page
{
 
    protected void Page_Init(object sender, System.EventArgs e)
    {
        invoicer inv = new invoicer();
        inv.DefineGridStructure(1, PlaceHolder1);
    }
 
 
    protected void Page_Load(object sender, EventArgs e)
    {
                
    }
 
 
}


I'm sure i'm doing something wrong, any help is very much appreciated.

Marin
Telerik team
 answered on 26 Sep 2013
3 answers
104 views
Hello everybody,

I am working on an application that was developed using IE 8 and the Q2 2012 AJAX controls (2012.2.607.40)

We have recently upgraded to Internet Explorer 10 and have encountered a number of formatting issues.
Attached are a couple of screen shots - the page as it looks in IE 8 and the same screen in IE 10.

I have tried adjusting the size of the columns but no matter what width they are the DatePicker and TimePicker fields use the entire width which results in the required field validator asterisk being pushed under the control.

<telerik:GridDateTimeColumn DataField="NULLABLE_TIMESHEET_ITEM_DATE" HeaderText="Date"
    PickerType="DatePicker" DataFormatString="{0:dd/MM/yyyy}" UniqueName="DateTimeColumEditor">
    <HeaderStyle Width="120px" />
</telerik:GridDateTimeColumn>
 
<telerik:GridDateTimeColumn HeaderText="Start Time" PickerType="TimePicker" DataField="NULLABLE_START_TIME"
    UniqueName="StartTimeColumn" DataFormatString="{0:HH:mm}" ColumnEditorID="DateTimeColumEditor">
    <HeaderStyle Width="105px" />
</telerik:GridDateTimeColumn>
 
<telerik:GridDateTimeColumn HeaderText="End Time" PickerType="TimePicker" DataField="NULLABLE_END_TIME"
    UniqueName="EndTimeColumn" DataFormatString="{0:HH:mm}" ColumnEditorID="DateTimeColumEditor">
    <HeaderStyle Width="105px" />
</telerik:GridDateTimeColumn>

Can anybody suggest a way to control the width of the Date and Time picker fields?

Thanks.
Eyup
Telerik team
 answered on 26 Sep 2013
8 answers
554 views

Could you please provide sample code for the new batch editing functionality for OnBatchEditCellValueChanged. I need to know the following:
1. The index of the row (to get values of other columns)
2. The ID of the column
3. Old value
4. New value

Thank you,
-Sam

Antonio Stoilkov
Telerik team
 answered on 26 Sep 2013
1 answer
112 views

I installed ASP.NET Ajax. I chose the Visual Studio 2013 option. I see no Telerik templates when I select New Project.



I am using VS 2013 RC on Windows 8.1 RTM.



Any ideas about a fix?



bill b

Vesko
Telerik team
 answered on 26 Sep 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?