Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
116 views
Hi. 

I have a RadGrid with the following settings:

<telerik:RadGrid ID="genericGrid" runat="server" AutoGenerateColumns="false" AllowAutomaticDeletes="false"
    AllowSorting="true" AllowAutomaticInserts="false" AllowAutomaticUpdates="true" OnDataBound="DataBoundGenericGrid"
    AllowCustomPaging="true" PageSize="100" AllowPaging="True" AutoGenerateEditColumn="true"
    AllowFilteringByColumn="true" AllowMultiRowSelection="true" OnUpdateCommand="ItemUpdatedEvent"
    OnCancelCommand="ItemCanceledHandler" OnInsertCommand="ItemInsertedEvent" OnEditCommand="ItemEditHandler"
    OnItemDataBound="ItemDataBoundEvent" OnNeedDataSource="GridNeedDataSource" Style="height: 600;
    width: 100%">
    <ClientSettings AllowDragToGroup="true" AllowGroupExpandCollapse="true">
        <Selecting AllowRowSelect="true" EnableDragToSelectRows="false" />
        <Scrolling AllowScroll="true" UseStaticHeaders="true" />
        <ClientEvents OnRowDblClick="RowDblClick" />
    </ClientSettings>
    <MasterTableView AutoGenerateColumns="true" AllowAutomaticDeletes="false" AllowFilteringByColumn="true"
        AllowAutomaticInserts="false" AllowAutomaticUpdates="true" GridLines="Vertical"
        TableLayout="Fixed" GroupLoadMode="Client" EditMode="InPlace" />
</telerik:RadGrid>
When we autogenerate columns from a DataTable everything works as expected:

genericGrid.DataSource = table.DefaultView;

http://dl.dropbox.com/u/4552022/workinggrid.png

But when i try to add the columns in code:

foreach (var gridColumn in _gridColumns)
            {
                genericGrid.Columns.Add(gridColumn);
            }
            genericGrid.DataSource = table.DefaultView;

I get this:

http://dl.dropbox.com/u/4552022/notworkinggrid.png

And also, doubleklicking a row is supposed to give editmode:
http://dl.dropbox.com/u/4552022/edit.png

But when adding columns manually it gives this error:
http://dl.dropbox.com/u/4552022/error.png

When manually creating columns, they are created like this: 

var dropDownColumn = new GridDateTimeColumn()
                         {
                             DataField = tableDefDto.ColumnId
                         };


The reason for doing this manually, is to enable the possiblity for dropdownColumns.

Any ideas?

Radoslav
Telerik team
 answered on 19 Sep 2011
3 answers
125 views
Hi,

I have a datetime column within my grid. I would like to set the value within this column to be empty anytime that the
datetime = 1/1/0001 12:00:00 AM

The row will still retain all other values. please let me know of anyways to do this.

thanks,
Minh Bui
Jayesh Goyani
Top achievements
Rank 2
 answered on 19 Sep 2011
1 answer
127 views
Can someone point me the right direction to implement a show a  Radwindow without refreshing the parent page in jquery and once the Radwindow is loaded, I need to make ajax calls from the Radwindow.

Thank you
Marin Bratanov
Telerik team
 answered on 19 Sep 2011
2 answers
58 views

Hello,

I have the following code which declares a radwindow in BasePage class, its works fine in aspx pages, but I can't use it in User Controls and Master Pages:

string BaseRadWindowID
        {
            get
            {
                return "UniqueBaseRadWindowID";
            }
        }
 
        RadWindow window = new RadWindow();// Create a enw Window
 
        RadWindow BaseRadWindow
        {
            get
            {
                return window;
            }
        }
 
        protected override void OnInit(EventArgs e)
        {
            this.window = new RadWindow();// Create a enw Window
            window.ID = BaseRadWindowID;// the id of the RadWindow;
            this.Form.Controls.Add(window);// Add it to the page
            base.OnInit(e);
        }
 
        public void ShowBaseRadWindow(bool visibleOnPageLoad, string navigationUrlQueryString)
        {
            BaseRadWindow.Width = Unit.Pixel(450);
            BaseRadWindow.Height = Unit.Pixel(150);
            BaseRadWindow.VisibleOnPageLoad = true;
            BaseRadWindow.VisibleStatusbar = true;
            BaseRadWindow.ReloadOnShow = true;
            BaseRadWindow.Modal = true;
            BaseRadWindow.Behaviors = WindowBehaviors.Close;
            BaseRadWindow.Style.Add("z-index", "10000");
            BaseRadWindow.NavigateUrl = "~/Pages/Messages/Default.aspx" + navigationUrlQueryString;
            BaseRadWindow.VisibleOnPageLoad = visibleOnPageLoad;
        }

I call the window in the aspx pages in this way:

this.ShowBaseRadWindow(true, string.Empty);

Please, I need your help in order to call the window and show it in User Controls and Master Pages.
It is very appreciated to send me the modified code.

Regards,
Bader

Bader
Top achievements
Rank 1
 answered on 18 Sep 2011
2 answers
172 views
How are you
I want to ask about important issue that i need to solve it as soon as possible
My scenario is RadGrid inside RadWindow, When I maximize The RadWindow, i need to maximIze RadGrid to fit the content of RadWindow also, when i return RadWindow to its normal size, i want RadGrid to return to its normal size
Also, PageSize DropDownList not working when Maximizing RadWindow;it works only when The RadWindow is in its normal size
My RadGrid uses UseStaticHeaders property to equal true and had fixed Width and Height
My RadWindow Markup is
 
<telerik:RadWindow ID="RadDeploymentWindow" Title="<%$ Resources:Text, DeploymentWizard %>"
    runat="server" VisibleOnPageLoad="false" VisibleStatusbar="false" Width="535px"
    Modal="true" Height="350px" Behaviors="Close,Move,Maximize,Reload " Skin="Windows7"
    IconUrl="~/Images/icons/Enterprise.png">
    <ContentTemplate>
My RadGrid Markup is
<telerik:RadGrid ID="DeploymentGrid" Skin="Office2007" runat="server" AutoGenerateColumns="False"
                                        AllowSorting="True" PageSize="10" ShowStatusBar="True" CellSpacing="0" GridLines="Both"
                                        AllowPaging="True" OnNeedDataSource="RadGrid_NeedDataSource" Height="225px" Width="516px">
                                        <ClientSettings>
                                            <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                                        </ClientSettings>
                                        <ExportSettings IgnorePaging="true" ExportOnlyData="true" OpenInNewWindow="true"
                                            HideStructureColumns="true" Excel-Format="Html" FileName="ErrorsAndWarnings">
                                        </ExportSettings>
                                        <MasterTableView DataKeyNames="ObjectID" AutoGenerateColumns="false" CommandItemDisplay="Top"
                                            CommandItemSettings-ShowAddNewRecordButton="false" CommandItemSettings-ShowRefreshButton="false">
                                            <CommandItemSettings ShowExportToWordButton="true" ShowExportToExcelButton="true" />
                                            <ItemStyle Wrap="false" />
                                            <Columns>
                                                <telerik:GridBoundColumn HeaderStyle-HorizontalAlign="Center" DataField="ObjectID"
                                                    HeaderText="ID">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn HeaderStyle-HorizontalAlign="Center" DataField="ObjectType"
                                                    HeaderText="Type">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn HeaderStyle-HorizontalAlign="Center" DataField="Name" HeaderText="Name">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn HeaderStyle-HorizontalAlign="Center" DataField="Attribute"
                                                    HeaderText="Attribute">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn HeaderStyle-HorizontalAlign="Center" DataField="Error" HeaderText="Description">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn HeaderStyle-HorizontalAlign="Center" DataField="ProposedSoluation"
                                                    HeaderText="Proposed Solution">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn HeaderStyle-HorizontalAlign="Center" DataField="Severity"
                                                    HeaderText="Severity">
                                                </telerik:GridBoundColumn>
                                            </Columns>
                                        </MasterTableView>
                                        <ClientSettings>
                                            <Resizing AllowColumnResize="True"></Resizing>                                            
                                        </ClientSettings>
                                    </telerik:RadGrid>
Ahmed
Top achievements
Rank 1
 answered on 18 Sep 2011
4 answers
119 views
I have a problem about checkbox and Web user control. I want tick checkbox when choose row in RadGrid. I use web page, I cant tick with this code:
var chbox = document.getElementById("checkbox1");
chbox.checked = true;

But when I use Web User Control, I have error. This code is not excute. Have you any idea? Thanks you very much!
Pham
Top achievements
Rank 1
 answered on 18 Sep 2011
4 answers
139 views
Hello,

I'm not sure if this is intended behavior, but it appears the pop-up modal edit form isn't so modal.  When in modal mode, you can actually tab through all the page controls.  If the control is a link and you press the enter key and it will post to the link.

You can try it out on the demo site:

http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/popupeditform/defaultcs.aspx

I've attached an image of two modal windows open at the same time.

Al
alo
Top achievements
Rank 1
 answered on 18 Sep 2011
2 answers
47 views
Hello everyone. I apologize for my English but I am Italian. I have this need. In a page I have included a 
TabStrip that draws a grid (made in C #) that contains a button that when clicked load in 
a UserControl the same page. 
I wish that when the page loads, the part relating to the UserControl is 
immediately loaded down with a downward effect, with no need to click on the button. You can 
help me? Thanks to all.
Peter
Telerik team
 answered on 17 Sep 2011
1 answer
135 views
I have used the NestedView several times but this is the first time I see this error.
I have a RadChar and a RadGrid in the nested and when I click on any row at first time, then the nested doesn't open, but after, I can open all nested.
  • I tried  change de databind of radchart on OnItemCommand and but not work
  • If  I remove de ajax it works prefectly
  • The subRadGrid created in the nested work, and do databind in the OnItemDataBound correctly
Why I lost first click?

ASPX
<telerik:RadGrid ID="RadGridInfoRecharges"
            OnItemCommand="RadGridInfoRecharges_ItemCommand"
            OnItemDataBound="RadGrid1_ItemDataBound"
            Skin="Default"
            runat="server"
            AutoGenerateColumns="False"
            AllowPaging="True"
            GridLines="Horizontal"
            CssClass="groupBox">
        <ExportSettings ExportOnlyData="false" FileName="Recharges" 
            IgnorePaging="true" OpenInNewWindow="True">
            <Csv ColumnDelimiter="Semicolon" />
        </ExportSettings>
            <MasterTableView DataSourceID="ObjectDataSourceGetRecharges" PageSize="50" DataKeyNames="OwnerId">
                <NestedViewTemplate>
                        <asp:Panel ID="NestedViewPanel" CssClass="InfoRechargesDetails" runat="server" >
                            <telerik:RadGrid ID="RadGridInfoRechargesNested"
                                    Skin="Default"
                                    runat="server"
                                    AutoGenerateColumns="False"
                                    AllowPaging="False"
                                    GridLines="Horizontal">
                                <MasterTableView>
                                    <Columns>
                                        <telerik:GridBoundColumn HeaderText="Credit"  DataFormatString="{0:N0}" DataField="Credit" UniqueName="Credit"></telerik:GridBoundColumn>
                                    </Columns>
                                </MasterTableView>
                            </telerik:RadGrid>
                            <telerik:RadChart ID="rcRechargesStatisticsRecharges" Width="900" Height="300" runat="server"
                            DefaultType="Line" Legend-Appearance-Visible="false" 
                            Legend-Visible="false" BorderWidth="0">
                            </telerik:RadChart>
                        </asp:Panel>
                </NestedViewTemplate>
                <ExpandCollapseColumn Visible="True"></ExpandCollapseColumn>
                <Columns>
                    <telerik:GridBoundColumn HeaderText="OwnerId"  ItemStyle-HorizontalAlign="Right" DataField="OwnerId" UniqueName="OwnerId"></telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
    </telerik:RadGrid>


CS ItemDataBound
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
       {
           if (e.Item is GridNestedViewItem)
           {
               int OwnerId = ((RechargeItemByContract)e.Item.DataItem).OwnerId;
               RadChart rcRechargesStatisticsRecharges = (RadChart)e.Item.FindControl("rcRechargesStatisticsRecharges");
               RadChart rcRechargesStatisticsPrices = (RadChart)e.Item.FindControl("rcRechargesStatisticsPrices");
 
               // DATA
               List<RechargeItemLite> Data = RechargesBLL.GetRechargeItemLite(OwnerId);
 
               if (Data.Count > 1)
               {
                   rcRechargesStatisticsRecharges.PlotArea.XAxis.Appearance.ValueFormat = Telerik.Charting.Styles.ChartValueFormat.ShortDate;
                   rcRechargesStatisticsRecharges.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = 45;
                   rcRechargesStatisticsRecharges.PlotArea.XAxis.AutoScale = false;
                   rcRechargesStatisticsRecharges.PlotArea.XAxis.IsZeroBased = false;
                   rcRechargesStatisticsRecharges.Legend.Visible = false;
                   rcRechargesStatisticsRecharges.ChartTitle.TextBlock.Text = "Creditos por recarga";
                   rcRechargesStatisticsRecharges.DataSource = Data;
                   double steps = (Data[0].OADate - Data[Data.Count - 1].OADate) / Data.Count;
                   rcRechargesStatisticsRecharges.PlotArea.XAxis.AddRange(Data[Data.Count - 1].OADate, Data[0].OADate, steps);
                   rcRechargesStatisticsRecharges.DataBind();
 
                   rcRechargesStatisticsRecharges.Series[0].DataXColumn = "OADate";
                   rcRechargesStatisticsRecharges.Series[1].Visible = false;
                   rcRechargesStatisticsRecharges.Series[2].Visible = false;
 
                   rcRechargesStatisticsRecharges.Visible = true;
               }
               else
                   rcRechargesStatisticsRecharges.Visible = false;

Or try
CS ItemComman
        protected void RadGridInfoRecharges_ItemCommand(object source, GridCommandEventArgs e)
        {
            // cazar el evento del expand/collapse
            if (e.CommandName == RadGrid.ExpandCollapseCommandName)
            {
                // Si el nestview no esta expandido significa que ahora es se expandera
                if (!e.Item.Expanded)
                {
                    #region declaraciones controles
                    RadGrid RadGridInfoRechargesNested = (RadGrid)((GridDataItem)e.Item).ChildItem.FindControl("RadGridInfoRechargesNested");
                    RadChart rcRechargesStatisticsRecharges = (RadChart)((GridDataItem)e.Item).ChildItem.FindControl("rcRechargesStatisticsRecharges");
                    RadChart rcRechargesStatisticsPrices = (RadChart)((GridDataItem)e.Item).ChildItem.FindControl("rcRechargesStatisticsPrices");
                    #endregion
                    // Extraemos la información de DataKeyValue desde la grid principal
                    int OwnerId = (int)((GridDataItem)e.Item).GetDataKeyValue("OwnerId");
 
                    // DATA
                    List<RechargeItemLite> Data = RechargesBLL.GetRechargeItemLite(OwnerId);
 
                    RadGridInfoRechargesNested.DataSource = Data;
                    RadGridInfoRechargesNested.DataBind();
 
                    if (Data.Count > 1)
                    {
                        rcRechargesStatisticsRecharges.PlotArea.XAxis.Appearance.ValueFormat = Telerik.Charting.Styles.ChartValueFormat.ShortDate;
                        rcRechargesStatisticsRecharges.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = 45;
                        rcRechargesStatisticsRecharges.PlotArea.XAxis.AutoScale = false;
                        rcRechargesStatisticsRecharges.PlotArea.XAxis.IsZeroBased = false;
                        rcRechargesStatisticsRecharges.Legend.Visible = false;
                        rcRechargesStatisticsRecharges.ChartTitle.TextBlock.Text = "Creditos por recarga";
                        rcRechargesStatisticsRecharges.DataSource = Data;
                        double steps = (Data[0].OADate - Data[Data.Count - 1].OADate) / Data.Count;
                        rcRechargesStatisticsRecharges.PlotArea.XAxis.AddRange(Data[Data.Count - 1].OADate, Data[0].OADate, steps);
                        rcRechargesStatisticsRecharges.DataBind();
 
                        rcRechargesStatisticsRecharges.Series[0].DataXColumn = "OADate";
                        rcRechargesStatisticsRecharges.Series[1].Visible = false;
                        rcRechargesStatisticsRecharges.Series[2].Visible = false;
 
                        rcRechargesStatisticsRecharges.Visible = true;
                    }
                    else
                        rcRechargesStatisticsRecharges.Visible = false;
Pavlina
Telerik team
 answered on 17 Sep 2011
3 answers
166 views
Hi,

We are using Radscheduler in our project. We need to show the dropdown calendar near the Header "Today" with 2 months column in a row. so we made the following changes.
 
RadCalendar popupCalendar = RadScheduler1.FindControl("SelectedDateCalendar") as RadCalendar;
 popupCalendar.AutoPostBack = true;
 popupCalendar.MultiViewColumns = 2;

This code shows 2 months but the problem now is, we are not able to navigate to next, previous, fast next and fast previous navigation.
When we click the next button  nothing happens. It seems the Autopost back is not working even we gave that in our code.

Please help us to resolve this issue.

Gopakumar
Plamen
Telerik team
 answered on 17 Sep 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?