Telerik Forums
UI for ASP.NET AJAX Forum
8 answers
292 views
Hello,
I'd like to refresh the page's title from an asp:Timer.
I'm in a master/detail ASP.NET scenario.
My Site.Master contains a telerik:RadAjaxManager (with the default EnableAJAX and EnablePageHeadUpdate set to "true"):
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" >
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="myTimer">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="label1" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
</telerik:RadAjaxManager>
Here is my (simplified) Tick event:
protected void myTimer_Tick(object sender, EventArgs e)
{
    label1.Text = "ABC";
    titrePage.Text = "DEF";
}

Here is the way I made the title editable from code-behind:
<head runat="server">
    <title id="titrePage" runat="server"></title>
</head>

The update of the label1 is OK, but the page's title isn't (note: the title *is* updated in a no-AJAX scenario).
I tried a:
<telerik:AjaxUpdatedControl ControlID="pageTitle" /> but it fails my entire page.
Thanks for your help ;).
Maria Ilieva
Telerik team
 answered on 07 Oct 2010
3 answers
202 views

I've accomplished having a Menu Item open a radWindow for the Menu control by setting the NavigateUrl attribute to empty string for those items I want to open the radWindow (as instructed by telerik support/forums -- only items with no NavigateUrl run the ItemClick event). I can obviously set the Node's NavigateUrl attribute to empty string as well on NodeDataBound event, but the SiteMap control does not provide an ItemClick/NodeClick event.

What's the best method for accomplishing this until you guys implement an similar Click event for the SiteMap control?

Thanks...
Helen
Telerik team
 answered on 07 Oct 2010
2 answers
202 views
I have a problem with the new window disappearing on load.  It seems to only happen with the MasterPage being used.

Link: (this link uses a page with no masterpage, with a tabstrip, multipageview)

http://www.bobbarker.com/DTIF/payment.aspx

the first click here link is a standard javascript window.open call.
the second click here link is a telerik radwindow.

both work.

then you go here and it is the SAME page, controls, etc. except it is using a MasterPage.

http://www.bobbarker.com/DTIF/Full/Account/Shop/payment.aspx

the javascript one works, the telerik radwindow opens, but then disappears.

So now I have altered the code to create the window from the code behind instead of calling the javascript function.  The window is created and visible but some how the menu control created in the MasterPage is still on top of that window while everything else on the page is behind the new window!!!!   SEE IMAGE
Georgi Tunev
Telerik team
 answered on 07 Oct 2010
1 answer
213 views

I opened a support ticket for this already (# 354150 ) - but wanted to get the community input on this as well and to share the solution - I'm sure I won't be the first or last to ask these questions...


I am creating a RadGrid on a page where this particular RadGrid is "loosely" bound in the sense that it only serves as a visualization of a 'summary' of some data that is presented elsewhere on another grid.

The visual paradigm desired is for a left-most column that is a GridClientSelectColumn followed by 2 more bound columns, one for an ID and another for a Name.  The remaining columns are dynamic based on another piece of supporting data (Unit Types)...  so the # of columns will vary depending on data. These dynamic columns are simply built to contain a single CheckBox control. I'm using a Template Column in this case because we want the CheckBox columns to always be editable without the row being in 'Edit' mode (if I set the row to edit mode manually, the alternating row-color theming is lost and the client wants to retain it)...  What I found was that the checkbox control in a template column was editable in all cases... a good thing for this particular scenario...

From what I've read it is reccomended to not mix static/dynamic column definition so all columns are being added dynamically at runtime in the Page_Init event (this Grid is hosted on a UserControl, not a true Page)... An additional noteworthy point is that the Page contains a RadTabStrip and RadMultiPage within a RadAjaxPanel... the UserControl hosting this RadGrid is on a RadPage (2nd tab if that matters) ....

The grid is defined in the markup as follows:

<telerik:RadGrid ID="TransporterAssignmentGrid" runat="server" OnItemCreated="TransporterAssignmentGrid_ItemCreated"
                OnItemDataBound="TransporterAssignmentGrid_ItemDataBound" OnNeedDataSource="TransporterAssignmentGrid_NeedDataSource"
                Width="99%" AutoGenerateColumns="false">
    <ClientSettings>
         <Selecting AllowRowSelect="true" />
    </ClientSettings>
    <MasterTableView DataKeyNames="TransporterId">
    </MasterTableView>
</telerik:RadGrid>

 

Then in the Page_Init event there is a call to the "CreateTransporterAssignmentGridColumns" operation whose code contains the follwing:

// Create the GridClientSelectColumn (checkbox/row-selection)...
GridClientSelectColumn gridClientSelectColumn = new GridClientSelectColumn();
gridClientSelectColumn.UniqueName = "GridClientSelectColumn";
gridClientSelectColumn.HeaderStyle.Width = System.Web.UI.WebControls.Unit.Pixel(25);
gridClientSelectColumn.ItemStyle.Width = System.Web.UI.WebControls.Unit.Pixel(25);

this.TransporterAssignmentGrid.MasterTableView.Columns.Add
    (
        gridClientSelectColumn
     );

// Create the TransporterId bound column...
GridBoundColumn transporterIdGridBoundColumn = new GridBoundColumn();
transporterIdGridBoundColumn.UniqueName = "TransporterIdColumn";
transporterIdGridBoundColumn.DataField = "TransporterId";
transporterIdGridBoundColumn.DataType = typeof(Int32);
transporterIdGridBoundColumn.ReadOnly = true;
transporterIdGridBoundColumn.HeaderText = "Transporter ID";
transporterIdGridBoundColumn.HeaderStyle.Width = System.Web.UI.WebControls.Unit.Pixel(125);
transporterIdGridBoundColumn.ItemStyle.Width = System.Web.UI.WebControls.Unit.Pixel(125);
 
this.TransporterAssignmentGrid.MasterTableView.Columns.Add
    (
        transporterIdGridBoundColumn
     );

// Create the TransporterName bound column...
GridBoundColumn transporterNameGridBoundColumn = new GridBoundColumn();
transporterNameGridBoundColumn.UniqueName = "TransporterNameColumn";
transporterNameGridBoundColumn.DataField = "TransporterName"; // Handled in ItemDataBound...
transporterNameGridBoundColumn.DataType = typeof(Int32);
transporterNameGridBoundColumn.ReadOnly = true;
transporterNameGridBoundColumn.HeaderText = "Transporter Name";
transporterNameGridBoundColumn.HeaderStyle.Width = System.Web.UI.WebControls.Unit.Pixel(350);
transporterNameGridBoundColumn.ItemStyle.Width = System.Web.UI.WebControls.Unit.Pixel(350);

this.TransporterAssignmentGrid.MasterTableView.Columns.Add
    (
        transporterNameGridBoundColumn
     );

// Create a column for each UnitCategory
foreach (UnitCategory unitCategory in ZoneMaintenancePage.UnitCategoryList)
{
    GridTemplateColumn gridTemplateColumn = new GridTemplateColumn();
    gridTemplateColumn.UniqueName = unitCategory.Name + "Column";
    gridTemplateColumn.HeaderText = unitCategory.Name;
    gridTemplateColumn.HeaderStyle.Width = System.Web.UI.WebControls.Unit.Pixel(100);
    gridTemplateColumn.ItemStyle.Width = System.Web.UI.WebControls.Unit.Pixel(100);
    gridTemplateColumn.ItemTemplate = new UnitCategoryColumnTemplate
        (
            this.Page,
            unitCategory.Name
         );

    this.TransporterAssignmentGrid.MasterTableView.Columns.Add
        (
            gridTemplateColumn
         );
}

The template for the Unit Category column contains a single CheckBox control...

/// <summary>
/// 
/// </summary>
private class UnitCategoryColumnTemplate : ITemplate
{
    #region Constructor

    /// <summary>
    /// 
    /// </summary>
    /// <param name="columnName"></param>
    public UnitCategoryColumnTemplate
        (
            Page parentPage,
            string unitCategtoryName                    
         )
    {
        this.ParentPage = parentPage;
        this.UnitCategoryName = unitCategtoryName;
    }

    #endregion

    #region Properties

    /// <summary>
    /// 
    /// </summary>
    public Page ParentPage { get; set; }

    /// <summary>
    /// 
    /// </summary>
    public string UnitCategoryName { get; set; }

    #endregion

    // Control Events

    #region UnitCategoryCheckBox_CheckedChanged
      
    /// <summary>
    /// 
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    public void UnitCategoryCheckBox_CheckedChanged(object sender, EventArgs e)
    {
        object x = sender as CheckBox;
    }

    #endregion

    // ITemplate Operations

    #region InstantiateIn

    /// <summary>
    /// 
    /// </summary>
    /// <param name="container"></param>
    public void InstantiateIn(System.Web.UI.Control container)
    {
        try
        {
            // Determine the Transporter ID...
            GridDataItem gridDataItem = container.NamingContainer as GridDataItem;

            int transporterId = Convert.ToInt32
                (
                    gridDataItem.GetDataKeyValue("TransporterId")
                 );

            CheckBox checkBox = new CheckBox();
            checkBox.ID = "Transporter" + transporterId + "_" + UnitCategoryName + "CheckBox";
            checkBox.AutoPostBack = true;

            checkBox.CheckedChanged += new EventHandler
                (
                    UnitCategoryCheckBox_CheckedChanged
                 );

            container.Controls.Add
                (
                    checkBox
                 );
        }
        catch
        {
            throw;
        }
    }

    #endregion
}

 

  • NOTE: The constructor argument/property ParentPage is only used so that calls to RadScriptManager.GetCurrent() can have a Page reference...

The item being used for the DataSource is a very simple List<T> object where the list item is a simple object with just the TransporterId property so that the grid can use that value for a DataKey... All the data binding is handled in the ItemDataBound event by using that TransporterId and other data sources...

protected void TransporterAssignmentGrid_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem gridDataItem = e.Item as GridDataItem;

        // Reference the TransporterId from the data-binding object...
        int transporterId = Convert.ToInt32
            (
                gridDataItem.GetDataKeyValue("TransporterId")
             );

        // Reference the Transporter for the current TransporterId...
        Transporter transporter = ZoneMaintenancePage.TransporterList.FindByTransporterId
            (
                transporterId
             );

        // Reference the ZoneTransporterAssignment entries for the current Transporter...
        TransporterZoneAssignmentList transporterZoneAssignmentList = ZoneMaintenancePage.TransporterZoneAssignmentList.FindByTransporterId
            (
                transporterId
             );

        // Populate the Transporter ID/Name columns...
        gridDataItem.Cells[gridDataItem.GetIndexOfColumn("TransporterIdColumn")].Text = transporter.Id.ToString();
        gridDataItem.Cells[gridDataItem.GetIndexOfColumn("TransporterNameColumn")].Text = transporter.Name;

        // Populate the Unit Category columns...
        foreach (UnitCategory unitCategory in ZoneMaintenancePage.UnitCategoryList)
        {
            // Reference the entry for this Unit Category (should be 1 record only if any)...
            TransporterZoneAssignmentList unitCategoryTransporterZoneAssignmentList = transporterZoneAssignmentList.FindByUnitCategoryId
                (
                    unitCategory.UnitCategoryId
                 );

            // Reference & populate the CheckBox for the appropriate GridCheckBoxColumn...
            CheckBox checkBox = gridDataItem.Cells[gridDataItem.GetIndexOfColumn(unitCategory.Name + "Column")].Controls[0] as CheckBox;
            checkBox.Checked = (unitCategoryTransporterZoneAssignmentList.Count > 0);
        }
    }
}

 

  • NOTE: Above there is a custom C# Extension Method being used by the name of 'GetIndexOfColumn'

The problem I am having is being able to use the CheckBox controls' CheckedChanged event... I can not get this Event to fire properly... I have an event wired-up in the Template control class itself and have used it to set a breakpoint and test - but I never hit my breakpoint...


Additionally,

[A] I've tried adding the EventHandler during the Grid's ItemDataBound event...

[B] I've tried adding the EventHandler during the Grid's ItemCreated event...

[C] I've tried adding RadScriptManager.GetCurrent(ParentPage).RegisterAsyncPostBackControl(checkBox) in the Template (before adding to the Controls collection)...

  

 

[D] I've tried adding RadScriptManager.GetCurrent(ParentPage).RegisterPostBackControl(checkBox) in the Template (before adding to the Controls collection)...

What I have been able to diagnose this far is that I'm getting a JavaScript error, which seems to be AJAX-related from what I've found via Google searching... I am getting the "PageRequestManagerParserErrorException" error... which is what led me to trying [C] and [D] above...

When I tried [D] above, I was able to see Page_Init/Load firing but I still get an exception - but oddly enough it's related to the GridClientSelectColumn for the current grid... The server-side exception message was "Multiple controls with the same ID 'GridClientSelectColumnSelectCheckBox' were found. FindControl requires that controls have unique IDs."

What is the appropriate approach to achieve these goals?  My desired functionality would be for the CheckedChanged event handler code to reside in the User Control itself - and not the template control... 

Tsvetina
Telerik team
 answered on 07 Oct 2010
2 answers
199 views

I have a asp:TextBox and RegExpTextBoxSetting that connected to it.
I have 2 qustions:
1.  Can the RegExpTextBoxSetting use with client function for validation? (instead the RegularExpression)
      I want that the checking will done by the function.

2.  Can I connect the RegExpTextBoxSetting to RadTextBox?
     In the examples, its working only with the asp:TextBox !

 
Thanks.

Tsvetina
Telerik team
 answered on 07 Oct 2010
1 answer
76 views
Hi All, Can anyone share a Demo Project which showcases the Export of Hierarchial Grid Data to ExcelML format (Export to Excel )

It would really be of great help.

Thanks
Daniel
Telerik team
 answered on 07 Oct 2010
2 answers
154 views
We need to maintain the opened radwindow to be available after postback , is there  a  way to the maintain the state .?
surendran
Top achievements
Rank 1
 answered on 07 Oct 2010
2 answers
68 views
Hallo,

is there a way to set the filterexpression of a column (containing integers) to show all Items that have a number "in" a specific range?

e.g FilterExpression= ([Number]  in 1,2,4-7,10) ->  to show all columns where the number is 1,2,4,5,6,7 or 10?

Thanks in Advance!
christian
Top achievements
Rank 1
 answered on 07 Oct 2010
1 answer
108 views
Hi,
Need help urgently, i have a scenario where there is a Radgrid and a RadAjax panel(consisting of textbox and button).
I am using Ajax to update the textbox when user clicks on the button located inside the radgrid, there is nor problem here as the textbox gets updated.
This is achieved using the radajax manager

 

 

 

      <telerik:AjaxSetting AjaxControlID="gvManageUsers">

 

 

          <UpdatedControls>

 

 

             <telerik:AjaxUpdatedControl LoadingPanelID="RadAjaxLoadingPanel" ControlID="gvManageUsers" />

 

 

            <telerik:AjaxUpdatedControl LoadingPanelID="RadAjaxLoadingPanel" ControlID="radPanel" />

 

 

         </UpdatedControls>

 

 

     </telerik:AjaxSetting>

 

 

 

 

 

 

Now When i try to update the radgrid from the radajax panel im unable to do that.In the code the grid is getting binded but it is not reflected on the UI.

I am using the below code

 

<

 

telerik:AjaxSetting AjaxControlID="radPanel">

 

 

 

    <UpdatedControls>

 

 

 

        <telerik:AjaxUpdatedControl LoadingPanelID="RadAjaxLoadingPanel" ControlID="gvManageUsers" />

 

 

 

       </UpdatedControls>

 

 

 

</telerik:AjaxSetting>

Any help is greatly appreciated

Regards
Abid

 



Maria Ilieva
Telerik team
 answered on 07 Oct 2010
1 answer
147 views
Hi,

I'm going to try and explane this as good as I can.
I have a ascx, it's very simple it only has a dropdown and some buttons.
When I click on one of the buttons I want to open a one of my aspx sites in/with a RadWindow, this works fine.
This aspx site has a diffrent ascx in it, and when I press a button in this ascx I want the RadWindow to close, faily simple.

But I have a big problem in geting the RadWindow to close.
I can ofcourse just press the red X, but I want the window to close automaticly when the user presses another button.

My RadWindowManager is located inside the first ascx, that ascx opens a aspx that contains a ascx, when the user presses a button in that ascx I want the RadWindow to close.

Lets give them some names:

DropDown.ascx (has the RadWindowManager a dropdown and a button that opens up Editor.aspx)
Editor.aspx (has the Fields.ascx control)
Fields.ascx (a control with a lot of fields that can be edited and a save button)

When the user presses that save button my codebehind in Editor.aspx catches this, it checks how the save goes and then I simply want that codebehind todo something like RadWindow1.Close().

I simply can't find or get a hold of the RadWindow from Editor.aspx

I've tried with Parent or FindControl or similar things, but I simply can't find it, and I don't know how to go on with this, how I can change it. Please help me.

Thanks for your help.
Georgi Tunev
Telerik team
 answered on 07 Oct 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?