Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
118 views
Hi,
      I'm aware that there is the functionality to reorder and move columns around in a gridview, however are there functions to Hide and Unhide specific columns and show all columns.

Regards

Robert
Shinu
Top achievements
Rank 2
 answered on 18 Nov 2009
1 answer
175 views
Hi,

I have one grid which contains around 150 records. I have Edit Case button. Initially I have set the Page Size of the grid as 10. User can change the page size and will select some 100th record and clicks on Edit case button.
I need to display the selected case details and also need to reduce the page size of the grid from 10 (Or user selected page size) to 5 and wherever the 100th record exists (i.e in any page) that needs to be highlighted. Is this possible in the RadGrid?

Regards,
Medac
Mira
Telerik team
 answered on 18 Nov 2009
1 answer
116 views
Is there a way to establish the datalabelscolumn for a numeric column?

I am returning  3 columns from a stored procedure.  Column 1 is weekname and has values 1-52 in rotating order, the other two are the series data.

DataLabelsColumn is being set in page.load as:

rctrend.PlotArea.XAxis.DataLabelsColumn = "weekname"

 


If from the stored procedure, I do this:  Select [weekname] as weekname
I get 3 series in my chart  and the datalabelscolumn directive is ignored.

If from the stored procedure, I do this:  Select convert(varchar(10),[weekname]) as weekname
or SELECT convert(text, convert(varchar(10),[weekname]) )) as weekname
I get 3 series in my chart and the datalabelscolumn directive is ignored.


If from the stored procedure, I do this:  SELECT 'w ' + convert(varchar(10), [weekname]) as weekname
DataLabelsColumn is respected and I get 2 series.

Whole routine is below:
    Private Sub MakeGraph()  
        If Not IsPostBack Then  
            rctrend.Chart.PlotArea.YAxis.AutoScale = True 
            rctrend.PlotArea.YAxis.AutoScale = True 
            rctrend.PlotArea.YAxis.IsZeroBased = False 
            rctrend.PlotArea.XAxis.DataLabelsColumn = "weekname" 
        End If  
 
        rctrend.ChartTitle.TextBlock.Text = "Something" 
        rctrend.DataSource = gensql.Get52WeekGraph  
        rctrend.DataBind()  
 
        If Not IsPostBack Then  
            rctrend.Series(0).Appearance.ShowLabels = False 
            rctrend.Series(1).Appearance.ShowLabels = False 
        End If  
    End Sub 
Giuseppe
Telerik team
 answered on 18 Nov 2009
17 answers
1.1K+ views
Hi,
 I am getting the following error when I am performing insert using "PerformInsert" from CommandItemTemplate.
Unable to cast object of type 'Telerik.Web.UI.GridCommandItem' to type 'Telerik.Web.UI.GridEditFormInsertItem'
ASPX Page : Grid Definition
<telerik:RadGrid ID="RadGrid1" Skin="Sunset" GridLines="None" runat="server" 
                 Width="97%" AllowPaging="True" AutoGenerateColumns="False" AllowMultiRowEdit="True" 
                OnNeedDataSource="RadGrid1_NeedDataSource"   
                AllowFilteringByColumn="True"    
                AllowSorting="True" PageSize="5" AllowMultiRowSelection="True"   
                ongridexporting="RadGrid1_GridExporting" OnItemCreated="RadGrid1_ItemCreated" 
                OnItemCommand="RadGrid1_ItemCommand" OnItemDataBound="RadGrid1_ItemDataBound">  
 
            <HeaderContextMenu Skin="Inox" EnableTheming="True">  
            <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
            </HeaderContextMenu> 
 
                <PagerStyle Mode="NextPrevNumericAndAdvanced" /> 
                <MasterTableView Width="100%" CommandItemDisplay="TopAndBottom" DataKeyNames="DespatchNum" GridLines="None"   
                     AutoGenerateColumns="False" EditMode="EditForms">  
                    <Columns>                 
ASPX : Command Item Template Definition
 <CommandItemTemplate> 
                    <div style="padding: 0 5px;">  
                        Custom command item template&nbsp;&nbsp;&nbsp;&nbsp;  
                        <asp:LinkButton ID="btnEditSelected" runat="server" CommandName="EditSelected" Visible='<%# RadGrid1.EditIndexes.Count == 0 %>'>  
                        <img style="border:0px;vertical-align:middle;" alt="" src="../App_Themes/Sunset/Edit.gif" /></asp:LinkButton>&nbsp;&nbsp;  
                          
                        <asp:LinkButton ID="btnUpdateEdited" runat="server" CommandName="UpdateAll" Visible='<%# RadGrid1.EditIndexes.Count > 0 %>'>  
                        <img style="border:0px;vertical-align:middle;" alt="" src="../App_Themes/Sunset/Update.gif" /></asp:LinkButton>&nbsp;&nbsp;  
                          
                        <asp:LinkButton ID="btnCancel" runat="server" CommandName="CancelAll" Visible='<%# RadGrid1.EditIndexes.Count > 0 || RadGrid1.MasterTableView.IsItemInserted %>' CausesValidation="False">  
                        <img style="border:0px;vertical-align:middle;" alt="" src="../App_Themes/Sunset/Cancel.gif" /></asp:LinkButton>&nbsp;&nbsp;  
                          
                        <asp:LinkButton ID="btnAddNew" runat="server" CommandName="InitInsert" Visible='<%# !RadGrid1.MasterTableView.IsItemInserted %>'>  
                        <img style="border:0px;vertical-align:middle;" alt="" src="../App_Themes/Sunset/AddRecord.gif" /></asp:LinkButton>&nbsp;&nbsp;  
                          
                        <%--<asp:LinkButton ID="btnInsert" runat="server" CommandName="PerformInsert" Text="Insert" Visible='<%# RadGrid1.MasterTableView.IsItemInserted %>'>  
                        <img style="border:0px;vertical-align:middle;" alt="" src="../App_Themes/Sunset/Update.gif" /></asp:LinkButton>&nbsp;&nbsp;--%> 
                          
                        <asp:LinkButton ID="btnInsert" runat="server" CommandName="PerformInsert" Visible='<%# RadGrid1.MasterTableView.IsItemInserted %>'>  
                        <img style="border:0px;vertical-align:middle;" alt="" src="../App_Themes/Sunset/Update.gif" /></asp:LinkButton>&nbsp;&nbsp;  
                          
                        <asp:LinkButton ID="btnDelete" OnClientClick="javascript:return confirm('Delete all selected customers?')" runat="server" CommandName="DeleteAll">  
                        <img style="border:0px;vertical-align:middle;" alt="" src="../App_Themes/Sunset/Delete.gif" /></asp:LinkButton>&nbsp;&nbsp;  
                          
                        <asp:LinkButton ID="btnRefresh" runat="server" CommandName="RebindGrid">  
                        <img style="border:0px;vertical-align:middle;" alt="" src="../App_Themes/Sunset/Refresh.gif" /></asp:LinkButton> 
                          
                        <asp:LinkButton ID="btnExportExcel" runat="server" CommandName="ExportToExcel">  
                        <img style="border:0px;vertical-align:middle;" alt="Export To Excel" src="" /></asp:LinkButton> 
                    </div> 
                </CommandItemTemplate> 

C# : Insert functionality inplemented in Item Command Event
 protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)  
        {  
            if (e.CommandName == "PerformInsert")  
            {  
                    //GridDataInsertItem insertedItem = e.Item as GridDataInsertItem;  
                GridEditFormInsertItem insertedItem = (GridEditFormInsertItem)e.Item;  
                  
                  
                //GridDataInsertItem insertedItem = (GridDataInsertItem)e.Item;  
 
                string Status = (insertedItem["DespatchStatus"].Controls[0] as TextBox).Text;  
                string RegionCode = (insertedItem["RegionCode"].FindControl("txtRegionCode") as TextBox).Text;  
                string LabCode = (insertedItem["LabCode"].Controls[0] as TextBox).Text;  
                string SampleCode = (insertedItem["SampleCode"].Controls[0] as RadComboBox).SelectedValue.ToString();  
            }  
        } 

I am getting error in line 6:
"GridEditFormInsertItem insertedItem = (GridEditFormInsertItem)e.Item;"

I have implemented Update and Delete methods similarly from Command Item Template, they seem to work fine. Just Insert is giving me this particular error.
But if i use the "Insert" button that comes by default in edit form, it is working fine.

I hope this information is sufficient. I you need further information please do let me know.

P.S : I have seen a few other suggestions in the forum saying to remove 
AllowAutomaticUpdates="true", AllowAutomaticInserts="true". I have removed all of them.
Yavor
Telerik team
 answered on 18 Nov 2009
1 answer
323 views
Hi

We have a javascipt function that is fired OnClientButtonClicked of a toolbar.  Some of the buttons on the toolbar have cause validation enabled while others don't.  Is there an easy way within the JS function to determine if the button clicked has CauseValidation set to false.

Thanks in advance.

Paul
Yana
Telerik team
 answered on 18 Nov 2009
2 answers
146 views
Hi!

I'm currently working on a project where I use the grid control in several pages. The control works fine, and when expanding to view detail tables the loading panel displays ok. The use can edit the information in the grid by clicking on a row. This in turn displays a rad window. When the editing is done, the window closes and a javascript calls rebind to refresh the grid. The grid updates ok, but now the loading panel is not being displayed. Any help will be much appreciated.

Thanks,
Harald
Harald
Top achievements
Rank 1
 answered on 18 Nov 2009
5 answers
133 views
After upgrading to Q2 2009 realease, my grid doesnt page any more - Everytime, it jumps back to page 1. Also my css changes for the combo boxes are gone.
Pavlina
Telerik team
 answered on 18 Nov 2009
1 answer
163 views
I am using automatic databinding, and I understand the model for handling errors during Create/Update/Delete actions of the CRUD model, but how/when do you handle errors during Read operations.

For instance you have a databound RadGrid, how do you handle errors that occur during the select operation, when populating the grid?

-Steve
Yavor
Telerik team
 answered on 18 Nov 2009
1 answer
84 views
Hi,

I am trying to add a new project that uses version 2009.2.927.35 of the Telerik DLL to our website. However, there are a number of projects already on there that use version 2008.1.619.20.
I can obviously add the new version to the GAC, and have registered it a as a safe control in the web.config. However, since I can't have both versions in the website BIN directory, I can't get this to work.

Is there any way that I can have both working side by side?

Thanks for any help!
Princy
Top achievements
Rank 2
 answered on 18 Nov 2009
1 answer
191 views
I saw a couple of similar threads and your recommendation of using a shared calendar control as a solution, however, this does not make much of a difference for me.
Compare this: testing of 100 rows - without date pickers: 0.57s, with 1 datepicker: 3-4s, 2 pickers: 8s!!
I am using all recommended server side optimisation - e.g. optimized stored procedure to get the data, NeedDataSource event etc. In fact, the page loads in about 2 seconds and what I see for the rest of the time is frozen grid, which would resize to 100% height after about 6 seconds. Any possible solutions here? The grid cannot be fixed size in my case, hence the Height is set to 100%. Thank you in advance.

here's the code:

<telerik:RadGrid ID="radGrid" runat="server" AutoGenerateColumns="false" BorderStyle="None" 
    EnableAjaxSkinRendering="true" AllowPaging="true" AllowMultiRowSelection="true" 
    Height="100%" EnableViewState="true"> 
    <MasterTableView ClientDataKeyNames="TxtSchoolId,TblActivityManagerGroupPupilLinkId" PageSize="10"> 
        <Columns> 
... 
           <telerik:GridTemplateColumn HeaderText="Start Date" UniqueName="DateFrom"> 
                <ItemTemplate> 
                    <telerik:RadDatePicker ID="StartDate" Width="60" runat="server" SelectedDate='<%#DataBinder.Eval(Container.DataItem, "dteStartDate")%>' 
                        ShowPopupOnFocus="true" DatePopupButton-Visible="false" SharedCalendarID="cal" ClientEvents-OnDateSelected="OnDateSelected" /> 
                </ItemTemplate> 
                <HeaderStyle Width="68" HorizontalAlign="Center" /> 
                <ItemStyle Width="68" HorizontalAlign="Center" /> 
            </telerik:GridTemplateColumn> 
... 
        </Columns> 
    </MasterTableView> 
    <ClientSettings EnableRowHoverStyle="true" EnableAlternatingItems="false"> 
        <Scrolling AllowScroll="true" UseStaticHeaders="true" /> 
        <Selecting AllowRowSelect="true" /> 
    </ClientSettings> 
</telerik:RadGrid> 
<telerik:RadCalendar ID="cal" runat="server" /> 

Regards,
Ruslan
Pavlina
Telerik team
 answered on 18 Nov 2009
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?