Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
1.0K+ views
Hi

I was quite surprised when using the RadTabStrip1.SelectedTab in a button click event in server side code to find that the value was null. I guess it makes sense as whatever tab a user clicks is all handled client side.
I decided to use the following code to find the selected tab server side. I've set the first tab selected by default.

Please can you tell me is this the correct way - or is there something easier?


<telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1" OnTabClick="RadTabStrip1_TabClick">
   <Tabs>
      <telerik:RadTab Text="Tab1" Selected="true"/>
      <telerik:RadTab Text="Tab2" />
      <telerik:RadTab Text="Tab2" />
   </Tabs>
</telerik:RadTabStrip>
 
<telerik:RadMultiPage ID="RadMultiPage1" runat="server">
   <telerik:RadPageView ID="RadPageView1" runat="server" Width="100%" Selected="true">xxx</telerik:RadPageView>
   <telerik:RadPageView ID="RadPageView2" runat="server" Width="100%">yyy</telerik:RadPageView>
   <telerik:RadPageView ID="RadPageView3" runat="server" Width="100%">zzz</telerik:RadPageView>
</telerik:RadMultiPage>

<asp:Button ID="btnOk" runat="server" Text="OK" onclick="btnOk_Click" />


The server-side code:
public string CurrentPageViewID
{
  get
  {
    if (ViewState["CurrentPageViewID"] != null)
      return (string)ViewState["CurrentPageViewID"];
    else
      return "RadPageView1";
  }
  set
  {
    ViewState["CurrentPageViewID"] = value;
  }
}
 
protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)
{
  //update current tab
  CurrentPageViewID = e.Tab.PageView.ID;
}
 
protected void btnOk_Click(object sender, EventArgs e)
{
  Response.Write("Current Tab PageView ID is " + CurrentPageViewID);
}
Jeremy
Top achievements
Rank 1
 answered on 06 Apr 2011
1 answer
111 views
I have read multiple articles on compiling a Web User Control into an assembly to be used by other applications.  I have done this part and it works fine using the Web Deployment Project add-in. 

When this assembly containing the web user controls are included in a web project,  they do not show up in the Toolbox of visual studio.  I understand that this is probably an issue of them being  System.Web.UI.UserControl.  However, I am placing the question here, How can I get this control to show up in the Toolbox? 

Since Telerik builds server control suites and the developers here are quite good, someone has got to know what class, interface, attributes, will turn this functionality on.  I tried the ToolboxData attribute, but  that doesn't change anything.  I have gone through the Apress server controls pro dev books and scourered online.  Help anyone?
Andrew Chandler
Top achievements
Rank 2
 answered on 06 Apr 2011
3 answers
69 views
I have a radgrid control which is bound to some data.
One of the columns is an image that I'd like to be excluded from my export button.
How can this be done?

Thanks
Daniel
Telerik team
 answered on 05 Apr 2011
3 answers
394 views
Team,

Pls. suggest me
1) while exporting radgrid data to word (am using ExportToWord() method) my client want to set Header and
Footer in the word document. Is it possible?
2) I want to Render Radgrid as a HTML to export to word (bcoz I want to apply CSS ) is it possible?

Give me the way to achieve this?

Daniel
Telerik team
 answered on 05 Apr 2011
1 answer
87 views
I have a grid with filtering enabled, bound to a DataTable object so that it supports automatic sorting.

There is a date field in the table, and as the RadGrid needs the date converting to mm/dd/yyyy format before it will filter correctly, I have intercepted the Filter command, cancelled it, and have rebound the list with the FilterExpression correctly set. See code below.

        protected void rgResults_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            try
            {
                if (e.Item is GridFilteringItem)
                {
                    Pair filterPair = (Pair)e.CommandArgument;
                    if (e.CommandName == RadGrid.FilterCommandName && filterPair.Second.ToString() == "Date")
                    {
                        e.Canceled = true;
                        GridFilteringItem item = (GridFilteringItem)e.Item;
                        GridBoundColumn col = (GridBoundColumn)item.OwnerTableView.GetColumnSafe(filterPair.Second.ToString());
                        DateTime date = DateTime.Parse(col.CurrentFilterValue);
                        item.OwnerTableView.FilterExpression = string.Format("([{0}] {1} #{2}#)", filterPair.Second.ToString(),       
                                                                      GetOperator(filterPair.First.ToString()), date.ToString("d", new CultureInfo("en-US")));
                        item.OwnerTableView.Rebind();
                    }
                }
...

To create the filter expression in T-SQL syntax, I need to get the T-SQL equivalent of the RadGrid filter operator. Is there a function I can use to do this? The grid obviously has to do the same to construct the filter expression, so I guess the functionality is in there somewher. Is it available through the API?

Thanks in advance,
Paul Taylor
Top achievements
Rank 1
 answered on 05 Apr 2011
2 answers
111 views
Is there any client-side sorting capability for the radGrid? (Such as you get with jQuery DataTables)

I have a radGrid where I'm filling one column on the client after the page is loaded. If I use the postback sorting functionality, then this data is lost, and will need to be regenerated. Client-side sorting would avoid this (and perform better by avoiding the server round trip delay).

The data I'm putting into the column is FLOT charts, plotted using data pulled down via a web service call. I store the data in the client to allow redrawing of larger versions of the chart, and plotting of alternate views/datasets.

It looks like server roundtrips, such as the postbacks on sorting, and opening of details tables loses all the stored data - I guess not surprisingly, as it's basically a new page to the browser, but it means that not only do I need to redraw the charts in the grid, but I also have to pull down the data again.

Thanks.
John
Top achievements
Rank 1
 answered on 05 Apr 2011
10 answers
173 views
When using the FormDecorator (all of the sudden) buttons on my pages are not rendering correctly, I assume it is a CSS issue.  There is a space in the button.  I'm not sure what changed to cause this issus.  Please see the attahed PNG file for an example.  Help!

Thank you in advance.
Chang-Ping
Top achievements
Rank 1
 answered on 05 Apr 2011
4 answers
58 views

Hello

   I am trying to customize the pagesize combo, but as a result the OnPagesizechanged event is not firing. Please help. Following is the code snippet


.ASPX

 < telerik:RadGrid AutoGenerateColumns="false" Width="100%" ID="RadGrid1" onneeddatasource
="RadGrid1_NeedDataSource" AllowFilteringByColumn="True" AllowSorting="True" OnItemDataBound
="RadGrid1_ItemDataBound"
PageSize="1" ShowFooter="True" AllowPaging="True" runat="server" OnPageSizeChanged
="RadGrid1_PageSizeChanged" GridLines="None" EnableLinqExpressions="false" OnItemCommand
="RadGrid1_ItemCommand">
<PagerStyle Mode="NextPrevAndNumeric"/> 

 

 

 

 

 

 


.Cs

 

 

 

 

protected void RadGrid1_ItemDataBound(object source, GridItemEventArgs e)
    {
        if (e.Item is GridPagerItem)
        {
            RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl("PageSizeComboBox");

 

            PageSizeCombo.Items.Clear();          
            PageSizeCombo.Items.Add(new RadComboBoxItem("1"));
            PageSizeCombo.FindItemByText("1").Attributes.Add("ownerTableViewID", RadGrid1.MasterTableView.ClientID);
            PageSizeCombo.Items.Add(new RadComboBoxItem("10"));
            PageSizeCombo.FindItemByText("10").Attributes.Add("ownerTableViewID", RadGrid1.MasterTableView.ClientID);
            PageSizeCombo.Items.Add(new RadComboBoxItem("15"));
            PageSizeCombo.FindItemByText("15").Attributes.Add("ownerTableViewID", RadGrid1.MasterTableView.ClientID);

 

            //PageSizeCombo.Attributes.Add("ownerTableViewID", RadGrid1.MasterTableView.ClientID);           
            PageSizeCombo.FindItemByText(RadGrid1.PageSize.ToString()).Selected = true;
            PageSizeCombo.AutoPostBack = true;
            //PageSizeCombo.EnableViewState = true;           
        }
    }

 

    protected void RadGrid1_PageSizeChanged(object sender, GridPageSizeChangedEventArgs e)
    {
        int i = e.NewPageSize;
    } 

 

 

 

 

 

 

 

 

 

 

 

Please let me know how i can get the PageSizeEventChanged event to fire. I would like to mention that i am using a RadAjaxManager on the page.

Thanks,
Kavitha

kavitha
Top achievements
Rank 1
 answered on 05 Apr 2011
5 answers
548 views
Hi

I have created a combobox with checkboxes in it
 <telerik:RadComboBox ID="cboMonth" runat="server" OnClientDropDownClosed="onClientDropDownClosed"
        <ItemTemplate> 
             <asp:CheckBox runat="server" ID="chk1" Checked="true"  Text='<%# DataBinder.Eval(Container, "Text") %>' /> 
        </ItemTemplate> 
</telerik:RadComboBox> 

which works a treat however when I try enable or disable it using Javascript

                if (item._text = " ") { 
                    cboCountries.enable() 
                } 
                else { 
                    cboCountries.clearSelection() 
                    cboCountries.disable(); 
                } 

When it is re-enabled the checkboxes are disabled and you I can not select them

I have tried manually setting the checkboxes disabled = false

 var items = cboCountries.get_items(); 
                    for (var i = 0; i < items.get_count(); i++) { 
 
                        var chk1 = $get(cboCountries.get_id() + "_i" + i + "_chk1"); 
                        chk1.disabled = false
                    } 

but this is not working either.

Anyone have any ideas?

TIA
Richard


Kalina
Telerik team
 answered on 05 Apr 2011
0 answers
115 views
Hi,

I have a RadListBox binded to an ObjectDataSource. The problem I am having is that when I insert/delete an item from the datasource, it is not reflected in the RadListBox. The OBjectDataSource's Select method is never called. The weird thing is that I use the same ObjectDataSource with other different RadListBoxes and they work fine, The listbox contains the changes made.

Any help would be appreciated...

Thanks

FileImport.ascx
 
%@ Control Language="C#" AutoEventWireup="true" CodeBehind="FileImport.ascx.cs" Inherits="Epsi.Segmentation.WebApp.SegmentationControls.FileImport" %>
<%@ Register src="UploadPrompt.ascx" tagname="UploadPrompt" tagprefix="uc1" %>
<%@ Register src="ColumnDetail.ascx" tagname="ColumnDetail" tagprefix="uc2" %>
<uc1:UploadPrompt ID="UploadPrompt1" runat="server" Visible="false" />
<uc2:ColumnDetail ID="ColumnDetail1" runat="server" Visible="false" />
<asp:HiddenField ID="HiddenFieldMode" runat="server" />
 
UploadPrompt.ascx
 
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UploadPrompt.ascx.cs" Inherits="Epsi.Segmentation.WebApp.SegmentationControls.UploadPrompt" %>
<script type='text/javascript' src="../assets/js/segmentation/upload_prompt.js"></script>
<telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" />
 
<asp:ObjectDataSource ID="ObjectDataSourceTables" runat="server" CacheDuration="10"
    DataObjectTypeName="Epsi.Segmentation.Dto.TblEntityDto"
    SelectMethod="SelectRegisteredUdtTables"
    TypeName="Epsi.Segmentation.WebApp.DataSource.ObjectDataSourceTables">
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSourceTags" runat="server" CacheDuration="10"
    DataObjectTypeName="Epsi.Segmentation.Dto.TagEntityDto" SelectMethod="Select"
    TypeName="Epsi.Segmentation.WebApp.DataSource.ObjectDataSourceTags" >
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSourceApps" runat="server" CacheDuration="10"
    DataObjectTypeName="Epsi.Segmentation.Dto.RefAppEntityDto" SelectMethod="Select"
    TypeName="Epsi.Segmentation.WebApp.DataSource.ObjectDataSourceApps">
</asp:ObjectDataSource>
 
<div id="Div1" runat="server" style="overflow: auto; margin: 25px; width: 90%;">
    <telerik:RadComboBox ID="RadComboBoxTable"
        Label="<%$ Resources:UserControlTextAndLabels, ExistingTableLabelResource%>"
        runat="server" DataSourceID="ObjectDataSourceTables" DataTextField="Name"
        OnClientSelectedIndexChanged="OnClientSelectedIndexChanged" DataValueField="Name" Width="100%"/>
</div>
 
<div id="Div2" runat="server" style="overflow: auto; margin: 25px; width: 90%;">
    <telerik:RadTextBox ID="RadTextBoxNewTable" runat="server" MaxLength="26"
        Label="<%$ Resources:UserControlTextAndLabels, NewTableLabelResource%>"  Width="100%">
        <ClientEvents OnValueChanged="textNewTableChanged" />
    </telerik:RadTextBox>
</div>
 
<asp:HiddenField ID="HiddenExistingTable" runat="server" />
 
<div id="Div3" runat="server" style="overflow: auto; margin: 25px; width: 90%;">
    <asp:Label ID="Label3" runat="server" Text="<%$ Resources:UserControlTextAndLabels, ImportFile%>"
        CssClass="rcbLabel riLabel" AssociatedControlID="RadUploadDataFile">
    </asp:Label>
    <telerik:RadUpload ID="RadUploadDataFile" runat="server"
        ControlObjectsVisibility="None" MaxFileInputsCount="1"
        OnClientAdded="onClientDataFileAddedHandler"
        Localization-Select="<%$ Resources:UserControlTextAndLabels, SelectTxtResource%>" Width="100%">
    </telerik:RadUpload>
</div>
 
<div id="Div5" runat="server" style="overflow: auto; margin: 25px; width: 90%;">
    <asp:Label ID="Label1" runat="server" Text="<%$ Resources:UserControlTextAndLabels, ApplicationsResource%>"
        CssClass="rcbLabel riLabel" AssociatedControlID="RadListBoxApps" />
    <br />
    <telerik:RadListBox ID="RadListBoxApps" runat="server" CheckBoxes="True" DataKeyField="Id"
        DataSortField="Name" DataSourceID="ObjectDataSourceApps" DataTextField="Name"
        DataValueField="Id" Style="overflow: auto;" Width="80%" Height="50px"
        ondatabound="RadListBoxApps_DataBound">
        <ButtonSettings ReorderButtons="Common" />
    </telerik:RadListBox>
</div>
 
<div id="Div6" runat="server" style="overflow: auto; margin: 25px; width: 90%;">
    <asp:Label ID="Label2" runat="server" Text="<%$ Resources:UserControlTextAndLabels, TagsColonResource%>"
        CssClass="rcbLabel riLabel" AssociatedControlID="RadListBoxTags" />
    <br />
    <telerik:RadListBox ID="RadListBoxTags" runat="server" CheckBoxes="True" DataKeyField="Id"
        DataSortField="Id" DataSourceID="ObjectDataSourceTags" DataTextField="Id"
        DataValueField="Id" Style="overflow: auto;" Width="80%" Height="50px"
        ondatabound="RadListBoxTags_DataBound">
        <ButtonSettings ReorderButtons="Common" />
    </telerik:RadListBox>
</div>
 
<div id="Div4" runat="server" style="overflow: auto; margin: 25px; width: 90%;">
    <asp:Button ID="submitButton" runat="server" Text="<%$ Resources:UserControlTextAndLabels, SubmitTxtResource%>"
        onclick="submitButton_Clicked" />
 
    <asp:Button ID="ButtonCancel" runat="server" Text="<%$ Resources:UserControlTextAndLabels, BtnCancelResource1 %>"
        CausesValidation="False" onclick="ButtonCancel_Click" />
</div>
gary
Top achievements
Rank 1
 asked on 05 Apr 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?