Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
95 views
There appears to be a HeaderTooltip and FilterImageTooltip, but nothing for an the DragImageUrl.  Is there some workaround or plans on adding this?
Marin
Telerik team
 answered on 17 Jun 2011
5 answers
881 views
Hi,
I am trying to get the total items count on my grid (total count of all the items in all the pages of the grid) in my code behind when Paging is enabled.
 
My data source for the grid returns 17 rows and the data is displayed in 2 pages. 
When i do an Items count it only returns me 10 (since my page size is 10)
i tried this code which was suggested in this forum -

 

<telerik:RadGrid ID="GridInvoiceDetailsPO" runat="server" AllowPaging="True"
AutoGenerateColumns="False" PageSize="10" Visible="True" Skin="Outlook"
PagerStyle-Mode="NextPrevAndNumeric" PagerStyle-AlwaysVisible="true"

.... />


int
i = GridInvoiceDetailsPO.Items.Count;
GridInvoiceDetailsPO.AllowPaging = false;
GridInvoiceDetailsPO.Rebind();
int j = GridInvoiceDetailsPO.Items.Count;
GridInvoiceDetailsPO.AllowPaging = true;
GridInvoiceDetailsPO.Rebind();
int k = GridInvoiceDetailsPO.Items.Count;

 

 

 

But i, j and k all return 10. is there something i am doing wrong?
Also i dont just want to get the total count, i want to iterate through the collection and get/set some data.

Ullas

 

 

Pavlina
Telerik team
 answered on 17 Jun 2011
3 answers
296 views
Hi Everyone,

First of all I have to say sorry about my English. It's not my parent language.

Let's focus on the problem I have now.  I have a rad grid with the editform. I am sure that I did follow the example.

Here are the codes I have done.

Design code in my user control.
<telerik:RadGrid ID="RadGrid1" AllowAutomaticUpdates="True" runat="server"
    Width="100%" GridLines="None"
            AutoGenerateColumns="False" PageSize="13" AllowSorting="True" AllowPaging="True"
            OnUpdateCommand="RadGrid1_UpdateCommand" OnNeedDataSource="RadGrid1_NeedDataSource"
            ShowStatusBar="True" OnInsertCommand="RadGrid1_InsertCommand"
    OnDeleteCommand="RadGrid1_DeleteCommand" AllowFilteringByColumn="True"
    CellSpacing="0" onitemdatabound="RadGrid1_ItemDataBound">
            <MasterTableView DataKeyNames="ID" AllowMultiColumnSorting="True" Width="100%"
                CommandItemDisplay="Top" InsertItemDisplay="Top"
                CommandItemSettings-AddNewRecordText="Add new record"
                HierarchyLoadMode="ServerBind">
<CommandItemSettings AddNewRecordText="Add new record" ExportToPdfText="Export to PDF"></CommandItemSettings>
 
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
 
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
                <Columns>
                <telerik:GridEditCommandColumn ButtonType="ImageButton"  EditImageUrl="~/RadControls/Grid/Skins/Edit.gif"  UniqueName="EditCommandColumn">
                        <HeaderStyle Width="16px"></HeaderStyle>
                        <ItemStyle Width="16px" />
                    </telerik:GridEditCommandColumn>
                    <telerik:GridButtonColumn ConfirmText="Are you sure you want to delete this record?" UniqueName="DeleteColumn" CommandName="Delete" ButtonType="ImageButton" ImageUrl="~/RadControls/Grid/Skins/Delete.gif" Text="Delete">
                    <HeaderStyle Width="16px"></HeaderStyle>
                        <ItemStyle Width="16px" /></telerik:GridButtonColumn>
                    <telerik:GridBoundColumn UniqueName="Name" SortExpression="Name" HeaderText="Document Name"
                        DataField="Name" />
                    <telerik:GridBoundColumn UniqueName="Description" HeaderText="Description" Visible="false"
                        DataField="Description" />
                    <telerik:GridDropDownColumn UniqueName="DocumentType" ListDataMember="DocumentType"
                        SortExpression="DocumentType" ListTextField="DocumentType" ListValueField="DocumentType"
                        HeaderText="Document type" DataField="DocumentType">
                    </telerik:GridDropDownColumn>
 <telerik:GridBoundColumn datafield="UpdateTime" AllowFiltering="false"
                                        DataFormatString="{0:dd MMM yyyy HH:mm:ss}" editformheadertextformat="{0}"
                                        headertext="Last Updated"
                                        readonly="True" uniquename="UpdateTime">
                                        <ItemStyle HorizontalAlign="Left" Width="160px" Wrap="False" />
                                        <HeaderStyle HorizontalAlign="Left" Width="160px" Wrap="False" />
                                    </telerik:GridBoundColumn>
                </Columns>
                <EditFormSettings  CaptionFormatString="Edit record : {0}" CaptionDataField="Name">
                    <FormTableItemStyle Width="100%" Height="29px"></FormTableItemStyle>
                    <FormTableStyle GridLines="None" CellSpacing="0" CellPadding="2"></FormTableStyle>
                    <FormStyle Width="100%" BackColor="#eef2ea"></FormStyle>
                    <EditColumn ButtonType="ImageButton"  />
                     
                </EditFormSettings>
            </MasterTableView>
<FilterMenu EnableImageSprites="False"></FilterMenu>
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
        </telerik:RadGrid>



And below is my code behind.
protected void Page_Load(object sender, EventArgs e)
       {
 
       }
       public void Initialize(int iProjectID)
       {
           RadGrid1.MasterTableView.EditMode = GridEditMode.EditForms;
           this.hdProjectID.Value = iProjectID.ToString();
           this.RadGrid1.DataBind();
            
       }
 
       protected void RadGrid1_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
       {
           GridEditableItem editedItem = e.Item as GridEditableItem;
           GridEditManager editMan = editedItem.EditManager;
 
           foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
           {
               if (column is IGridEditableColumn)
               {
                   IGridEditableColumn editableCol = (column as IGridEditableColumn);
                   if (editableCol.IsEditable)
                   {
                       IGridColumnEditor editor = editMan.GetColumnEditor(editableCol);
 
                       string editorType = editor.ToString();
                       string editorText = "unknown";
                       object editorValue = null;
 
                       if (editor is GridTextColumnEditor)
                       {
                           editorText = (editor as GridTextColumnEditor).Text;
                           editorValue = (editor as GridTextColumnEditor).Text;
                       }
 
                       if (editor is GridDropDownColumnEditor)
                       {
                           editorText = (editor as GridDropDownColumnEditor).SelectedText + "; " +
                               (editor as GridDropDownColumnEditor).SelectedValue;
                           editorValue = (editor as GridDropDownColumnEditor).SelectedValue;
                       }
 
                       try
                       {
                           int iDataID = (int)editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["EmployeeID"];
                           Data oData = new Data(iDataID, this.UserID);
                           bool bUpdated = false;
                           switch(column.UniqueName)
                           {
                               case "Name":
                                   oData.Name = editorValue.ToString();
                                   bUpdated = true;
                                   break; 
                               case "Description":
                                   oData.Description = editorValue.ToString();
                                   bUpdated = true;
                                   break;
                               case "DataType":
                                   oData.TypeID = Convert.ToInt32(editorValue.ToString());
                                   break;
                           }
                           if (bUpdated)
                           {
                             //
                           }
                       }
                       catch (Exception ex)
                       {
                           RadGrid1.Controls.Add(new LiteralControl("<strong>Unable to update'" + column.HeaderText + "' value.</strong> - " + ex.Message));
                           e.Canceled = true;
                           break;
                       }
                   }
               }
           }
       }
 
 
       protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
       {
           Datas oDatas = new Datas(Convert.ToInt32(this.hdProjectID.Value), this.UserID, true);
           this.RadGrid1.DataSource = oDatas;
       }
       protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
       {
           switch (e.CommandName)
           {
               case "":
                   if (RadGrid1.EditIndexes.Count == 0)
                   {
                       return;
                   }
 
                   foreach (GridDataItem item in RadGrid1.EditItems)
                   {
                       GridEditableItem itemToEdit =
                       (item.OwnerTableView.EditMode == GridEditMode.InPlace) ?
                       (GridEditableItem)item : (GridEditableItem)item.EditFormItem;
                       //UpdateItem(itemToEdit);
                   }
 
                   e.Item.OwnerTableView.Rebind();
                   break;
           }
       }
       protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e)
       {
           GridEditableItem editedItem = e.Item as GridEditableItem;
           GridEditManager editMan = editedItem.EditManager;
           Datas oDatas = new Datas(Convert.ToInt32(this.hdProjectID.Value), this.UserID, true);
           Data oDoc = oDatas.Add(1);
           foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
           {
               if (column is IGridEditableColumn)
               {
                   IGridEditableColumn editableCol = (column as IGridEditableColumn);
                   if (editableCol.IsEditable)
                   {
                       IGridColumnEditor editor = editMan.GetColumnEditor(editableCol);
 
                       string editorText = "unknown";
                       object editorValue = null;
 
                       if (editor is GridTextColumnEditor)
                       {
                           editorText = (editor as GridTextColumnEditor).Text;
                           editorValue = (editor as GridTextColumnEditor).Text;
                       }
                       if (editor is GridDropDownColumnEditor)
                       {
                           editorText = (editor as GridDropDownColumnEditor).SelectedText + "; " +
                            (editor as GridDropDownColumnEditor).SelectedValue;
                           editorValue = (editor as GridDropDownColumnEditor).SelectedValue;
                       }
 
                       try
                       {
                           switch (column.UniqueName)
                           {
                               case "Name":
                                   oDoc.Name = editorValue.ToString();
                                   break;
                               case "Description":
                                   break;
                               case "DataType":
                                   break;
 
                           }
                         
                       }
                       catch (Exception ex)
                       {
                           RadGrid1.Controls.Add(new LiteralControl("Unable to add new Data. Reason: " + ex.Message));
                           e.Canceled = true;
                       }
 
                   }
               }
           }
       }
       protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
       {
           if (e.Item is GridEditableItem && e.Item.IsInEditMode)
           {
               GridEditableItem editedItem = e.Item as GridEditableItem;
               GridEditManager editMan = editedItem.EditManager;
               GridDropDownListColumnEditor editor = (GridDropDownListColumnEditor)(editMan.GetColumnEditor("DataType"));
               DropDownList ddList = editor.DropDownListControl;
               DataTypeList oDTList = new DataTypeList();
               ddList.DataSource = oDTList;
               ddList.DataBind();
           }
       }
       protected void RadGrid1_DeleteCommand(object source, GridCommandEventArgs e)
       {
           int ID = Convert.ToInt32((e.Item as GridDataItem).OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ID"].ToString());
           Datas oDatas = new Datas(Convert.ToInt32(this.hdProjectID.Value), this.UserID, true);
           oDatas.Remove(ID);
       }


Just in case you guys want to know what kind of datatype that I'm binding it to the grid. It's the arraylist.


Could you please tell where in the code that I miss ? Right now when I click on the "Insert new record " It show me the edit form . But once I click on the update button . There is nothing happen.


Thank you so much.


Dang
Tsvetoslav
Telerik team
 answered on 17 Jun 2011
7 answers
466 views
I have a RadGrid which is created at runtime and added to a place holder control.

I set the commandItemSettings.ShowExportToExcelButton = true and the built-in export button appears.

After the grid is created I call the Rebind() method so that my NeedDataSource event is raised (Advanced Data Binding):

I'm using NeedDataSource event:
 void radGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            this.radGrid.DataSource = this.dataSource;
        }

When I click the Export to Excel button nothing happens.

How should I implement this or use it so that the export works?

Many thanks,
Pooya
Top achievements
Rank 1
 answered on 17 Jun 2011
3 answers
132 views
Hi!

We have implemented a custom solution with the RadScheduler with WebService(and a DbSchedulerProvider) binding using the online demos.

I have one question: after the Appointment save process the GetAppointments method is re-called and it calls the LoadResources(Apppointment apt) method.

What should this method return? All the Scheduler Resources or just the Appointment resources?

It all seems fine until we try to edit/update the Appoinment as the Resources doesnt show up with the selected resources(in DropDownLists). We are only returning the Appointment resource collection.

Best regards

Software Development
Top achievements
Rank 1
 answered on 17 Jun 2011
4 answers
118 views
I have a masked text box inside an update panel.  The masked text box has hideonblur set to true, and uses an empty message.  When the page loads, the masked text box displays the empty message correctly.  When I type a value in the masked text box, the empty message is correctly hidden.

I then click a button.  The click event of this button is a trigger on the update panel that contains my masked text box.  The page is asynchronously posted back, and when it finishes, the masked text box now displays the empty message instead of the value that was entered!  If you click in the masked text box to give it focus, then tab out, the empty message is now hidden, and the value again displayed.

How can I keep my masked text box inside the update panel and not have it incorrectly hide my value?  The only solution I've found is to remove the empty message AND hideonblur, which causes the mask to always display, which is not what I want.

I am using the standard MS AJAX panels.  Any help is appreciated.
Karl
Top achievements
Rank 1
 answered on 17 Jun 2011
1 answer
40 views
Whenever I perform an ajax postback using the RadAjaxManager, I get a line break added to the top of the page. Everything just shifts down 1 line. This only happens if I use master pages. I tried creating a single aspx form and it works fine. I created a basic masterpage and added a panel for refresh. I've tried moving the panel and button to a content page and using a RadAjaxManagerProxy but I get the same result. Also, this only happens when I publish this to the server. Running on local I do not get the issue.

Clicking on the 'SubmitBtn' refreshes the panel but it drop down 1 line.

<%@ Master Language="VB" AutoEventWireup="false" CodeBehind="Site1.master.vb" Inherits="RadControlsWebApp1.Site1" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
              <Scripts>
                     <%--Needed for JavaScript IntelliSense in VS2010--%>
                     <%--For VS2008 replace RadScriptManager with ScriptManager--%>
                     <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>
       <script type="text/javascript">
           //Put your JavaScript code here.
    </script>
    <telerik:RadAjaxLoadingPanel runat="server" ID="LoadingPanel1" Skin="Office2007" />
       <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="SubmitBtn">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="testPanel" LoadingPanelID="LoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
       </telerik:RadAjaxManager>
    <div>
        <asp:Panel runat="server" ID="testPanel">
            test<br />
            <telerik:RadButton ID="SubmitBtn" runat="server" Text="Postback" Skin="Office2007" />
        </asp:Panel>
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
          
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>
Mira
Telerik team
 answered on 17 Jun 2011
1 answer
90 views
Can I change the behaviour of the spline curve at all and how it figures out the curve?

For example in the attached picture my yaxis values of the purple line are 14, 0, 0, 0, 14, 0

Can i alter the curve to not drop below the 0 line? Is the spline type the right thing for what I am doing here?
Missing User
 answered on 17 Jun 2011
1 answer
105 views
I can get the minor and major tick marks and grid lines sorted, but the base (zero) line is solid black, and can't quite figure out how to style it. Have attached picture to illustrate.
Thanks!

Missing User
 answered on 17 Jun 2011
1 answer
91 views
Hello.

I make a user control and add RadTooltipManager on master page and OnLoad of my control I do next:
    /// <summary>
    /// Tooltip description
    /// </summary>
    public string Description
    {
        get;
        set;
    }   
 
protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
 
        RadToolTipManager tooltipManager;
        tooltipManager = this.Page.Master.FindControl("tooltipManager") as RadToolTipManager;
        if (tooltipManager == null)
        {
            throw new ApplicationException("There are no Tooltip Manager on the page!");
        }           
        tooltipManager.TargetControls.Add(this.hplnkInfo.ClientID,Description,true);          
    }
And when I initialize property Description of my control I see empty tooltip when click on control/
I think TooltipTargetControlCollection.Add(string controlID,string val,bool isClientID) works like "val" is the tooltip which showing by RadTooltipManager near controlID control.
Is it true?
And how can I show different tooltip on different controls using one RadTooltipManager and passing to it tooltip message?

Thank you.
Marin Bratanov
Telerik team
 answered on 17 Jun 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?