Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
52 views
I have written a component which is used in several places. It can be used as usual (simply at a page) and in RadWindow. It contains some jscript code which must determine if this component is in RadWindow or not. How can it be done? Thanks in advance.
Alex
Top achievements
Rank 1
 answered on 13 Dec 2010
1 answer
91 views
Hi.
I have a grid where i manually insert a record. When the grid is empty (after clearing the list with a button), the new record is not displaying in the grid after insert is done. But when the grid has records then the insert record is displaying. Hope some have any idea why this happen. The code i am using is:

<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" Culture="Norwegian, Bokmål (Norway)"
        GridLines="None" ShowStatusBar="True" ondatabound="RadGrid1_DataBound" oninsertcommand="RadGrid1_InsertCommand" onitemcommand="RadGrid1_ItemCommand"
        onitemdatabound="RadGrid1_ItemDataBound" onpageindexchanged="RadGrid1_PageIndexChanged" onneeddatasource="RadGrid1_NeedDataSource"
        ondeletecommand="RadGrid1_DeleteCommand" onprerender="RadGrid1_PreRender" onupdatecommand="RadGrid1_UpdateCommand" >
        <MasterTableView AutoGenerateColumns="False" CommandItemDisplay="Top" DataKeyNames="CardNumber" InsertItemPageIndexAction="ShowItemOnCurrentPage">
        <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
        <Columns>      
            <telerik:GridBoundColumn FilterControlWidth="95%" DataField="InfoEasy_Customer.CustomerNumber" DataType="System.String" HeaderText="Kundenr." SortExpression="InfoEasy_Customer.CustomerNumber" UniqueName="CustomerNumber" AutoPostBackOnFilter="true" ShowFilterIcon="false">
            <HeaderStyle Width="80px"></HeaderStyle><ItemStyle HorizontalAlign="Right" /></telerik:GridBoundColumn>
            <telerik:GridBoundColumn FilterControlWidth="95%" DataField="InfoEasy_Customer.Name" DataType="System.String" HeaderText="Kundenavn" SortExpression="InfoEasy_Customer.Name" UniqueName="CustomerName" ReadOnly="true" AutoPostBackOnFilter="true" ShowFilterIcon="false">
            <HeaderStyle Width="160px"></HeaderStyle></telerik:GridBoundColumn>
            <telerik:GridBoundColumn FilterControlWidth="95%" DataField="CardNumber" DataType="System.String" HeaderText="Serienr." SortExpression="CardNumber" UniqueName="CardNumber" AutoPostBackOnFilter="true" ShowFilterIcon="false">
            <HeaderStyle Width="80px"></HeaderStyle><ItemStyle HorizontalAlign="Right" /></telerik:GridBoundColumn>
            <telerik:GridBoundColumn FilterControlWidth="95%" DataField="CardStatus" DataType="System.Int32" HeaderText="Aktivt" SortExpression="CardStatus" UniqueName="CardStatus" DefaultInsertValue="">
            <FilterTemplate>
                <telerik:RadComboBox ID="ImportedFilter" runat="server" OnClientSelectedIndexChanged="ImportedFilterSelectedIndexChanged"
                            SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("CardStatus").CurrentFilterValue %>' Width="40px">
                            <Items>
                                <telerik:RadComboBoxItem Text="" Value="" />
                                <telerik:RadComboBoxItem Text="Ja" Value="1" />
                                <telerik:RadComboBoxItem Text="Nei" Value="0" />
                            </Items>
                        </telerik:RadComboBox>
                        <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
                            <script type="text/javascript">
                                function ImportedFilterSelectedIndexChanged(sender, args) {
                                    var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                    var filterVal = args.get_item().get_value();
                                    if (filterVal == "") {
                                        tableView.filter("CardStatus", filterVal, "NoFilter");
                                    }
                                    else if (filterVal == "1") {
                                    tableView.filter("CardStatus", "1", "EqualTo");
                                    }
                                    else if (filterVal == "0") {
                                    tableView.filter("CardStatus", "0", "EqualTo");
                                    }
                                }
                            </script>
                        </telerik:RadScriptBlock>
            </FilterTemplate>
            <HeaderStyle Width="55px"></HeaderStyle><ItemStyle HorizontalAlign="center"/></telerik:GridBoundColumn>       
            <telerik:GridBoundColumn FilterControlWidth="95%" DataField="VehicleRegistrationNumber" HeaderText="Reg.nr." SortExpression="VehicleRegistrationNumber" UniqueName="VehicleRegistrationNumber" AutoPostBackOnFilter="true" ShowFilterIcon="false">
            <HeaderStyle Width="90px"></HeaderStyle></telerik:GridBoundColumn>       
            <telerik:GridBoundColumn FilterControlWidth="95%" DataField="CustomerCardGroup.Name" HeaderText="Kundens sortering" SortExpression="CustomerCardGroup.Name" UniqueName="GroupName" AutoPostBackOnFilter="true" ShowFilterIcon="false">
            <HeaderStyle Width="130px"></HeaderStyle></telerik:GridBoundColumn>
            <telerik:GridDateTimeColumn FilterControlWidth="95%" DataField="IssuedDate" DataType="System.DateTime" HeaderText="Utlevert" SortExpression="IssuedDate" UniqueName="IssuedDate" AutoPostBackOnFilter="true" ShowFilterIcon="false">           
            <HeaderStyle Width="105px"></HeaderStyle></telerik:GridDateTimeColumn>         
            <telerik:GridBoundColumn FilterControlWidth="95%" DataField="Comment" HeaderText="Kommentar" SortExpression="Comment" UniqueName="Comment" AutoPostBackOnFilter="true" ShowFilterIcon="false">
            <HeaderStyle Width="130px"></HeaderStyle></telerik:GridBoundColumn>
            <telerik:GridTemplateColumn UniqueName="Selected" HeaderText="Velg" AllowFiltering="false" HeaderStyle-Width="40px" HeaderTooltip="Brukes for Ã¥ huke av hvilken rad som skal gjelde ved felles handlinger">
                    <ItemTemplate>
                        <asp:CheckBox ID="SelectedCheckBox" runat="server" Checked='<%#( (Container is GridDataInsertItem) ? false: Eval("IsSelected")) %>' ToolTip="Huke av ved felles handlinger"/>           
                    </ItemTemplate>
            <HeaderStyle HorizontalAlign="Center" /><ItemStyle HorizontalAlign="center"/></telerik:GridTemplateColumn>                    
            <telerik:GridEditCommandColumn CancelText="Avbryt" EditText="Endre" InsertText="Sett inn" UpdateText="Oppdater"><HeaderStyle Width="50px"></HeaderStyle><ItemStyle HorizontalAlign="Right" /></telerik:GridEditCommandColumn>
            <telerik:GridButtonColumn HeaderStyle-Width="40px" CommandName="Delete" Text="Slett" UniqueName="column1" ConfirmDialogType="RadWindow" ConfirmText="Er du sikker pÃ¥ at du vil slette elementet?" ConfirmTitle="Bekreft sletting"><HeaderStyle Width="40px"></HeaderStyle></telerik:GridButtonColumn>     
        </Columns>   
        <EditFormSettings EditFormType="Template">
           <EditColumn UniqueName="EditCommandColumn1" ></EditColumn>
           <FormTemplate>                
                <div style="padding:10px;">         
                <table>
                    <tr>
                        <td><asp:Label runat="server" ID="Label1" Text="Kundenr."></asp:Label></td>
                        <td><telerik:RadNumericTextBox runat="server" ID="CustomerNumber" Width="70px"><NumberFormat DecimalDigits="0"/></telerik:RadNumericTextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator1" Text="*" ForeColor="Red" ControlToValidate="CustomerNumber" runat="server"/></td>                       
                        <td><asp:Label runat="server" ID="Label3" Text="Serienr."></asp:Label></td>
                        <td><telerik:RadNumericTextBox runat="server" ID="CardNumber" Text='<%# Bind("CardNumber") %>' Width="70px"><NumberFormat DecimalDigits="0"/></telerik:RadNumericTextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator2" Text="*" ForeColor="Red" ControlToValidate="CardNumber" runat="server"/></td>                                                                                  
                        <td><asp:Label runat="server" ID="Label6" Text="Utlevert"></asp:Label></td>
                        <td><telerik:RadDatePicker runat="server" ID="IssuedDate" Width="105px"></telerik:RadDatePicker><asp:RequiredFieldValidator ID="RequiredFieldValidator3" Text="*" ForeColor="Red" ControlToValidate="IssuedDate" runat="server"/></td>                       
                        <td><asp:Label runat="server" ID="Label4" Text="Reg.nr." ToolTip="Max 15tegn"></asp:Label></td>
                        <td><telerik:RadTextBox ID="RegNumber" runat="server" Width="130px" Text='<%# Bind("VehicleRegistrationNumber") %>' MaxLength="15"></telerik:RadTextBox></td>                       
                        <td><asp:Label runat="server" ID="Label7" Text="Kommentar"></asp:Label></td>
                        <td rowspan="2" valign="top"><telerik:RadTextBox ID="Comment" runat="server" Text='<%# Bind("Comment") %>' Height="47px" Width="250px" TextMode="MultiLine" MaxLength="255"></telerik:RadTextBox></td>                       
                    </tr>
                    <tr>
                        <td colspan="2"></td>
                        <td><asp:Label runat="server" ID="Label2" Text="Aktivt"></asp:Label></td>
                        <td><telerik:RadComboBox runat="server" ID="RadComboBox1" Width="40px" DataValueField="CardStatus" SelectedValue='<%#Bind("CardStatus") %>' HighlightTemplatedItems="true">
                            <Items>
                                <telerik:RadComboBoxItem Value="1" Text="Ja" runat="server" />
                                <telerik:RadComboBoxItem Value="0" Text="Nei" runat="server"/>
                            </Items>
                            </telerik:RadComboBox>
                        </td>                         
                        <td><asp:Label runat="server" ID="Label8" Text="Gyldig"></asp:Label></td>
                        <td><telerik:RadDatePicker runat="server" ID="ValidToDate" Width="105px"></telerik:RadDatePicker><asp:RequiredFieldValidator ID="RequiredFieldValidator4" Text="*" ForeColor="Red" ControlToValidate="ValidToDate" runat="server"/></td>                                               
                        <td><asp:Label runat="server" ID="Label5" Text="Sortering"></asp:Label></td>
                        <td><telerik:RadTextBox ID="GroupName" runat="server" Width="130px" MaxLength="255"></telerik:RadTextBox></td>
                        <td colspan="2"></td>
                    </tr>
                </table>               
                <div id="Buttons" style="text-align:right;">                 
                        <asp:LinkButton ID="LbtnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Sett inn" : "Oppdater" %>' runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' TabIndex="40"></asp:LinkButton
                        <asp:LinkButton ID="LbtnCancel" Text="Avbryt" runat="server" CausesValidation="False" CommandName="Cancel" TabIndex="41"></asp:LinkButton>                       
                </div>
            </div>               
            </FormTemplate>
            </EditFormSettings>
            <NoRecordsTemplate><div>Det er ingen elementer Ã¥ vise</div></NoRecordsTemplate
        </MasterTableView>    
        <ClientSettings EnableRowHoverStyle="true">                    
            <ClientEvents OnRowDblClick="RowDblClick" />
            <Selecting AllowRowSelect="true"/>
            <Resizing AllowColumnResize="true"/>
        </ClientSettings
        <SortingSettings EnableSkinSortStyles="False" SortedAscToolTip="Sortert stigende" SortedDescToolTip="Sortet synkende" SortToolTip="Klikk her for Ã¥ sortere" />     
    </telerik:RadGrid>

  protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e)
 {          
            if (!(e.Item is GridEditFormInsertItem))
                return;

            var insertItem = (GridEditFormInsertItem)e.Item;
            FcCustomerCard controller = GetController();
            string message = controller.Save(insertItem, true);
            if (!string.IsNullOrEmpty(message))
            {
                hasActionFailed = true;
                DisplayMessage("Elementet kan ikke settes inn. Ã…rsak: " + message);
                e.Canceled = true;
            }
            else
            {
                DisplayMessage("Insettingen var vellykket.");                   
            }
        }

  protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {      
            RadGrid1.DataSource = GetCardList();
        }

 protected void clrFilters_Click(object sender, EventArgs e)
        {
            foreach (GridColumn column in RadGrid1.MasterTableView.Columns)
            {
                column.CurrentFilterFunction = GridKnownFunction.NoFilter;
                column.CurrentFilterValue = string.Empty;
            }
            SetFilterExpression();
            RadGrid1.MasterTableView.Rebind();
        }

 private void SetFilterExpression()
        {
            RadGrid1.MasterTableView.FilterExpression = "([CardNumber] = " + value + ") ";
            RadGrid1.EnableLinqExpressions = false;
            RadGrid1.GroupingSettings.CaseSensitive = false;
            GridColumn column = RadGrid1.MasterTableView.GetColumnSafe("CardNumber");            
            column.CurrentFilterFunction = GridKnownFunction.EqualTo;                
            RadGrid1.MasterTableView.Rebind();
        }
Martin
Telerik team
 answered on 13 Dec 2010
1 answer
323 views
So I have a grid with a template column, and that column has  alinkbutton in it:
<telerik:RadGrid ID="rgCSVTest" runat="server" AllowPaging="true" Visible="false">
      <MasterTableView>
          <Columns>
          <telerik:GridTemplateColumn HeaderText="Edit" UniqueName="tmpEdit">
              <ItemTemplate>
                  <asp:LinkButton ID="btnTmpEdit" runat="server" CommandName="Edit" Text="Edit" />
              </ItemTemplate>
          </telerik:GridTemplateColumn>
I'd like to be able to access the "btnTmpEdit" linkbutton, so I can add an "onmouseover" and "onmouseout" event to trigger a popup when the user hovers over it. I know how to add the client-side events, I just need to know how I can access this button in codebehind? is this possible? Thanks in advance.
Pavlina
Telerik team
 answered on 13 Dec 2010
2 answers
114 views
I have written a custom content provider for RadFileExplorer, and have been pretty happy with the results, with one little caveat, and that is the ability to specify an icon for the files.

I create my FileItems, and everything is working fine, except for the icon. I am essentially doing this:

new FileItem(
    "123456789",                  // name
    ".aspx",                      // extension
    0,                            // size
    "123/456/789",                // path
    "Handler.aspx?sid=123456789", // url
    null,
    PathPermissions.Read)

It seems to me that specifying the extension field of the FileInfo object should be sufficient to decide what icon is displayed if it is has been specified, and the control can look elsewhere if it is not.  I am using the same semantics as Path.GetFileExension() used in the samples.  If this isn't used to specify the icon, what in the heck is it used for?

The only way I can get the icon to appear is to put the file extension at the end of the name.  I do not want the file extension to appear as part of the the file name.  This seems like very odd behavior given that the extension is specified explicitly.  Is this a bug?
Joel Kraft
Top achievements
Rank 2
 answered on 13 Dec 2010
3 answers
56 views
Dear,

We currently using Telerik in our development. and we planning to migrate our servers, developpers and users PCs from from office 2000 to office 2007.

We wonder if there is any impact on our product already developed or those to be developed?
we would like your confirmation for Export function that we use with telerik, is't built-in and independant from Excel or is it depend on our office version that is installed on our servers?
Thanks for your support and help.

Iana Tsolova
Telerik team
 answered on 13 Dec 2010
4 answers
137 views
I keep my radEditor configuration in a.skin file. I have tried to set the allowed file extensions in the skin file using this syntax:

<DocumentManager UploadPaths="~/Docs" ViewPaths="~/Docs" DeletePaths="~/Docs" MaxUploadFileSize="1100000" SearchPatterns="*.doc,*.txt,*.docx,*.xls,*.xlsx,*.pdf,*.zip"/>

It does not work. I use the radEditor in multiple locations within the site, so I do not want to set the searchPatterns for each instance. How can I achieve this?

Thanks
Stewart Ellis
Top achievements
Rank 1
 answered on 13 Dec 2010
4 answers
100 views

Hi,

We have a strange behavior with the target attribute on links: 
- When we add a link in HTML mode an specify a target attribute other than "_blank" then switch to the Preview mode and back to the HTML mode, the attribute is renamed original_target=... and a new target attribute is added an it's value is always "_blank". Lik this:

<a href="http://www.google.com/" target="_blank" original_target="_top">www.google.com</a>

We had this issue while using version 5.7.1 and we've been told to upgrade to 5.8.4 but after the upgrade the problem is still present.

What should I do ?

Sébastien Nunes
Top achievements
Rank 1
 answered on 13 Dec 2010
1 answer
53 views
Hi,

just wanted to expand my panelbar client side and found the code in the online documentation. But it didn't work, but i i found another working way.

- not working:

http://www.telerik.com/help/aspnet-ajax/panel_clientsidebasics.html

function expandItem(text)
{
var panelBar = $find("<%= RadPanelBar1.ClientID %>");
var item
= panelBar.findItemByText(text);
if (item)
{
  
item.expand();
}
else
{
  
alert("Item with text not found.");
}
}


- working:

function ExpandPanelBarItem()
            {
                var panelBar = $find("<%= RadPanelBar1.ClientID %>");
                panelBar.get_allItems()[0].expand();
            }

(Care -> in this example this is enough because its just 1 panelbaritem in the panelbar which i want to be opened.)

- Mario
Yana
Telerik team
 answered on 13 Dec 2010
3 answers
111 views
Hello,

I am grouping my appointments by a resource: 'Rooms'.

There are three Rooms and when I insert an appointment in say, 'Mr. Smith's Room', I want to be able to obtain the value: 'Mr. Smith's Room' in my 'OnClientAppointmentInserting' function.

How can I achieve this?

Regards,
Anthony
Anthony
Top achievements
Rank 1
 answered on 13 Dec 2010
3 answers
2.3K+ views
I am using Custom Dropdown Filter for a template comun in detail grid , the dropdown is coming fine but when i selected value to filter i am getting the below error
Unable to cast object of type 'System.Web.UI.WebControls.TextBox' to type 'Telerik.WebControls.RadComboBox'.
the same thing working fine with parent grid but failing in Detail Grid.

Can anyone help me to resolve this issue.
Radoslav
Telerik team
 answered on 13 Dec 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?