Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
119 views
So, here's my scenario - in our app, the content of the window can very likely change, so what I've done is added the following to the pages being opened:

function pageLoad() { fixWindow(); }
 
function fixWindow() {
  // Fix the height to show the buttons in the right place.
  var oWnd = GetRadWindow();
  var contentHeight = $('#mainContent').height();
  var newHeight = contentHeight + 10;
  var windowWidth = oWnd.get_width();
  $('#popupWrapper').height(newHeight);
  $('#popupWrapper').width(windowWidth - 75);
  var windowHeight = newHeight + 105;
  oWnd.set_height(windowHeight + "px");
  // if (oWnd != null) {
      // oWnd.center();
  // }
}

This works great, except that if I then try to center the window every time, the window will remain open after a postback. How can I correct this so that the window gets centred and works normally?

(Side note: We tried using the auto-size, but it never did a great job of keeping the window sized properly).

Thanks,
Kori
Marin Bratanov
Telerik team
 answered on 26 Mar 2012
3 answers
254 views
I have list of products displayed in a RadListView. I would like to group those products by Category (where Category is a property of the Product class)
Is that even possible using RadListView?

In your samples, you only have basic grouping using a predefined number of items per group.
Thanks,
Gary


Here is the code I'm using:
<telerik:RadListView ID="listViewProducts" runat="server"
       onneeddatasource="listViewProducts_NeedDataSource" ItemPlaceholderID="ProductsHolder"        
      DataKeyNames="ProductCatalogID" >
                 <AlternatingItemTemplate>
                 <div class="rlvA" style="height: 160px; width: 200px; margin-top: 5px;
                               margin-right: 5px; margin-bottom: 5px; padding-left: 5px;">
                               <table cellpadding="1" cellspacing="1" border="0" width="200">
                                   <tr style="height:60px;">
                                   <td class="header4" ><%#Eval("Products")%></td>
                                   </tr>
                                   <tr>
                                   <td align="center"><%--<asp:ImageButton ID="ImageButton2" ImageUrl="~/Images/Product.jpg" PostBackUrl='<%# Eval("Link")%>' runat="server" target="_blank" />--%>
                                   <asp:ImageButton ID="ImageButton1" ImageUrl="~/Images/Product.jpg"  runat="server" OnClientClick=<%# "window.open('" + Eval("Link") + "','',''); return false;" %>  /></td>
                                   </tr>
                               </table>
                                       
 
                           </div>
                       </AlternatingItemTemplate>
                       <ItemTemplate>
                       <div class="rlvI" style="height: 160px; width: 200px; margin-top: 5px;
                               margin-right: 5px; margin-bottom: 5px; padding-left: 5px;">
                               <table cellpadding="1" cellspacing="1" border="0" width="200">
                                   <tr style="height:60px;">
                                   <td class="header4"><%#Eval("Products")%></td>
                                   </tr>
                                   <tr>
                                   <td align="center"><asp:ImageButton ID="ImageButton3" ImageUrl="~/Images/Product.jpg"  runat="server" OnClientClick=<%# "window.open('" + Eval("Link") + "','',''); return false;" %>  /></td>
                                   </tr>
                               </table>
                                
                       
                        
                       </div>
                       
                       </ItemTemplate>
                       <EmptyDataTemplate>
                           <div class="RadListView RadListView_Windows7">
                               <div class="rlvEmpty">
                                   There are no items to be displayed.</div>
                           </div>
                       </EmptyDataTemplate>
                       <LayoutTemplate>
                           <div style="width:1150px;" class="RadListView RadListViewFloated RadListView_Windows7">
                               <div class="rlvFloated rlvAutoScroll">
                                   <div id="Div1" runat="server">
                                     <div id="ProductsHolder" runat="server">
                                   </div>
                               </div>
 
                           </div>
                       </LayoutTemplate>
                      
      
   </telerik:RadListView>
Vasil
Telerik team
 answered on 26 Mar 2012
4 answers
177 views
Hi,

I've just upgraded to the latest and greatest ASP.Net AJAX controls and everything works fine apart from the image that is displayed in the image editor. When I click an image in the image manager the image is displayed fine but when I click the image editor button the image briefly appears but then is replaced by a broken image symbol. If I save the broken image, it then displays fine as a new image within the image manager. I am not using a custom content provider.

Attached is a screen shot showing the image editor.

Any ideas?

Thanks

Tim Metcalfe
Danny
Top achievements
Rank 1
 answered on 26 Mar 2012
3 answers
347 views
Hello,

Am having radtreeview on my webpage for which i want to add folder icon before every node.
how to achieve that?

 

 

<telerik:RadTreeView ID="RadTreeViewSource" runat="server" Height="580px"

 

 

 

OnNodeClick="RadTreeViewSource_NodeClick" >

 

 

 

<DataBindings>

 

 

 

<telerik:RadTreeNodeBinding Expanded="false" />

 

 

 

</DataBindings>

 

 

 

</telerik:RadTreeView>

Above is my code.
am binding treeview in codebehind with datattable value.

Thanks,
Mugdha

 

Bozhidar
Telerik team
 answered on 26 Mar 2012
1 answer
94 views
Hi all,

I've successfully created a casecaded radcombobox using the demo from here:

http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multiplecomboboxes/defaultcs.aspx 

I'm now trying to turn this into a user control and create it dynamically. The problem is the Page_Load JS function of the user control never fires. Also whenever the Page_Load of the aspx.cs fires IsPostback is always true. Can anyone help? 

User control code behind:
public partial class ctrlCascadedProcedureDropDown : System.Web.UI.UserControl
{
    public int ProcedureTypeSelectedValue { get; set; }
    public int ProcedureSelectedValue { get; set; }
 
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadProcedureTypes();
 
            if (ProcedureTypeSelectedValue > 0)
                LoadProcedures(ProcedureTypeSelectedValue.ToString());
 
            rcbProcedureType.SelectedValue = ProcedureTypeSelectedValue.ToString();
            rcbProcedure.SelectedValue = ProcedureSelectedValue.ToString();
        }
        else if (!Page.IsCallback)
        {
            if (rcbProcedureType != null)
                LoadProcedures(rcbProcedureType.SelectedValue);
        }
    }
 
    protected void rcbProcedureType_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
    {
        LoadProcedureTypes();
    }
 
    protected void rcbProcedure_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
    {
        LoadProcedures(e.Text);
    }
 
    protected void LoadProcedureTypes()
    {
        TARNDB.OpsProcedureType opsProcedureType = new TARNDB.OpsProcedureType();
        rcbProcedureType.DataSource = opsProcedureType.GetProcedureTypes().OrderBy(x => x.ProcedureType);;
        rcbProcedureType.DataValueField = "ID";
        rcbProcedureType.DataTextField = "ProcedureType";
        rcbProcedureType.DataBind();
 
        rcbProcedureType.Items.Insert(0, new RadComboBoxItem("")); 
    }
 
    protected void LoadProcedures(string proceduretypeid)
    {
        int _proceduretypeid;
        if (int.TryParse(proceduretypeid, out _proceduretypeid))
        {
            TARNDB.OpsProcedure opsProcedure = new TARNDB.OpsProcedure();
            rcbProcedure.DataSource = opsProcedure.GetProcedures(_proceduretypeid).OrderBy(x => x.ProcedureName); ;
            rcbProcedure.DataValueField = "ID";
            rcbProcedure.DataTextField = "ProcedureName";
            rcbProcedure.DataBind();
        }
    }
}

User control mark-up:
<div>
<telerik:RadComboBox ID="rcbProcedureType" runat="server"
    OnClientSelectedIndexChanging="LoadProcedures"
    OnItemsRequested="rcbProcedureType_ItemsRequested" />
<telerik:RadComboBox ID="rcbProcedure" runat="server" Width="250px"
    OnClientItemsRequested="ItemsLoaded"
    OnItemsRequested="rcbProcedure_ItemsRequested" />
</div>
 
<script type="text/javascript">
 
var rcbProcedure;
var rcbProcedureType;
 
function pageLoad() {
    rcbProcedure = $find("<%= rcbProcedure.ClientID %>");
    rcbProcedureType = $find("<%= rcbProcedureType.ClientID %>");
 
    alert("in");
}
 
function LoadProcedures(sender, eventArgs) {
    var item = eventArgs.get_item();
    rcbProcedure.set_text("Loading...");
 
    // if a procedure type is selected
    if (item.get_index() > 0) {
        // this will fire the ItemsRequested event of the
        // procedures combobox passing the procedureTypeID as a parameter
        rcbProcedure.requestItems(item.get_value(), false);
    }
    else {
        // the -Select a continent- item was chosen
        rcbProcedure.set_text(" ");
        rcbProcedure.clearItems();
    }
}
 
function ItemsLoaded(sender, eventArgs) {
    if (sender.get_items().get_count() > 0) {           
        // pre-select the first item
        sender.set_text(sender.get_items().getItem(0).get_text());
        sender.get_items().getItem(0).highlight();
    }
    //sender.showDropDown();
}
 
</script>

Page using the user control code behind:
public partial class Operations : BasePage
{
    public List<DynamicControl> DynamicControls
    {
        get
        {
            return (List<DynamicControl>)Session["_DynamicControls"];
        }
        set
        {
            Session["_DynamicControls"] = value;
        }
    }
 
    protected void Page_Init(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DynamicControls = null;
        }
        else
        {
            if (DynamicControls != null && DynamicControls.Count > 0)
            {
                foreach (DynamicControl control in DynamicControls)
                {
                    ctrlCascadedProcedureDropDown cpd = new ctrlCascadedProcedureDropDown();
                    cpd.ID = control.ID;
 
                    switch (control.PlaceHolder.ID)
                    {
                        case "phProcedure":
                            phProcedure.Controls.Add(cpd);
                            phProcedure.Controls.Add(new Literal() { Text = "<BR />" });
                            break;
                        default:
                            break;
                    }
                }
            }
        }
    }
 
    protected void btnAddProcedure_Click(object sender, EventArgs e)
    {
        AddDynamicProcedureControl("Procedure", phProcedure);
    }
 
    private void AddDynamicProcedureControl(string name, PlaceHolder placeHolder, int procedureTypeSelectedValue = 0,
        int procedureSelectedValue = 0)
    {
        Control control = LoadControl("~/Controls/ctrlCascadedProcedureDropDown.ascx");
        ctrlCascadedProcedureDropDown cpd = (ctrlCascadedProcedureDropDown)control;
 
        int controlCount = (DynamicControls == null ? 0 : DynamicControls.Count);
        string ID = string.Concat(name, controlCount.ToString());
        cpd.ID = ID;
        cpd.ProcedureTypeSelectedValue = procedureTypeSelectedValue;
        cpd.ProcedureSelectedValue = procedureSelectedValue;
 
        DynamicControl dc = new DynamicControl() { ID = ID, PlaceHolder = placeHolder };
        if (DynamicControls == null)
            DynamicControls = new List<DynamicControl>();
        DynamicControls.Add(dc);
 
        placeHolder.Controls.Add(cpd);
        placeHolder.Controls.Add(new Literal() { Text = "<BR />" });
    }
 
    private List<int> GetDynamicList(PlaceHolder placeHolder)
    {
        List<int> list = null;
        list = new List<int>();
        foreach (Control control in placeHolder.Controls)
        {
            if (control is GenericDropDown)
            {
                int id;
                if (int.TryParse(((GenericDropDown)control).SelectedValue, out id) && id > 0)
                    list.Add(id);
            }
        }
 
        return list;
    }
}

Paul
Top achievements
Rank 1
 answered on 26 Mar 2012
1 answer
98 views
hi,
I need to create UPDATES statements from a RadGrid,
How to edit the information and export them to excel file to create UPDATE statements?
Antonio Stoilkov
Telerik team
 answered on 26 Mar 2012
1 answer
89 views

I have a radgrid bound to a iList of objects. I have a command button that executes a javascript function that executes an ajax request using a radajaxmanager. This request adds a number of new objects to the list then calls the rebind method of the grid. The new objects appear in the grid briefly then dissappear and only the original objects are there. If i execute the ajax request again, you can see all the newly added objects fomr the second request, plus the previously added objects from the first request, plus the original objects for a brief moment, then they dissappear and the grid only shows the original objects. 

The list actually contains all the objects, but the grid seems to be reverting back to the original cache when the app started.

Anyone seen this before? 

I am using the grid in other places without problem.
Maria Ilieva
Telerik team
 answered on 26 Mar 2012
3 answers
297 views
Hi ,
I am using RadWindowManager in my application , I need to send a argument from the Window to its parent Control.I am adding the records form Rad Window which are displayed on its parent control , when i hit a particular button i need to refresh the parent so that the records get updated in the parent control without closing the Rad Window..

Can some one help me on this?

Thanks
rdmptn
Top achievements
Rank 1
 answered on 26 Mar 2012
1 answer
84 views
I have a ribbonbar in a masterpage. What I want to accomplish is to perform a response.redirect("urlhere") when the end user clicks on a tab. I am trying to accomplish this by using the following code below:
Private Sub rrbMain_SelectedTabChange(sender As Object, e As Telerik.Web.UI.RibbonBarSelectedTabChangeEventArgs) Handles rrbMain.SelectedTabChange
    Select Case e.Tab.Text
        Case "Tab1"
            Response.Redirect("~/tab1.aspx")
        Case "Tab2"
            Response.Redirect("~/tab2.aspx")
    End Select
End Sub

Unfortunately, that does not work. Clicking on a tab does not perform any redirection. Your help is appreciated. Thanks.



Bozhidar
Telerik team
 answered on 26 Mar 2012
1 answer
428 views
Hello,

Am havinf 2 usercontrols in my project and both are having RadAjaxManager.
i have register both controls on singel page.

<%

 

@ Register TagPrefix="ModelData" TagName="ucSourscDoc" Src="~/PeerBenchmarking/controls/ucSourceDocument.ascx" %>

 

<%

 

@ Register TagPrefix="ModelData" TagName="ucUploadDoc" Src="~/PeerBenchmarking/controls/ucUploadDocument.ascx" %>

 


So its giving me error as

Only one instance of a RadAjaxManager can be added to the page!

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Only one instance of a RadAjaxManager can be added to the page!

i need RadAjaxManager on both usercontrol because i want to show loading image while datatloading.

Any solution for this?
Shinu
Top achievements
Rank 2
 answered on 26 Mar 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?