Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
515 views
Hi,
i've got a problem and dont know how to make it. Ive got a master site:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Default.master.cs" Inherits="Gambu.Client.Web.Default" %>
 
<!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>
    <telerik:RadStyleSheetManager id="RadStyleSheetManager" runat="server" />
    <link rel="stylesheet" type="text/css" href="./Styles/Table.css" />
</head>
<body>
    <form id="MainForm" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager" runat="server">
            <Scripts>
                <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>
        <telerik:RadAjaxManager  ID="RadAjaxManager" runat="server" EnableHistory="True" />
        <telerik:RadSkinManager ID="RadSkinManager" Runat="server" Skin="Windows7" />
        <telerik:RadFormDecorator ID="RadFormDecorator" runat="server" Skin="Windows7" />
        <asp:ContentPlaceHolder ID="MainContentPlaceHolder" runat="server">
        </asp:ContentPlaceHolder>
        </form>
</body>
</html>
Default.cs: OnLoad i check if user is logged in, if no than show window with login:
var rWindow = new RadWindow();
rWindow.Title = "Logowanie";
rWindow.NavigateUrl = "Users/Login.aspx";
rWindow.Skin = "Windows7";
rWindow.IconUrl = "--";
rWindow.AutoSize = true;
rWindow.Modal = true;
rWindow.EnableShadow = true;
rWindow.EnableViewState = false;
rWindow.VisibleTitlebar = true;
rWindow.VisibleStatusbar = false;
rWindow.VisibleOnPageLoad = true;
rWindow.ShowContentDuringLoad = false;
rWindow.OnClientClose = "OnClientClose";
rWindow.Behaviors = Telerik.Web.UI.WindowBehaviors.Move;
WindowManager.Windows.Add(rWindow);
After user loggs in, i close the window and an event is fired:
function OnClientClose(oWnd, args) {
        var ajaxManager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>");
        ajaxManager.ajaxRequest("client");
    }
 it fires in Default.aspx:
<%@ Page Title="" Language="C#" MasterPageFile="~/Default.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Gambu.Client.Web.Default1" %>
 
<asp:Content ID="HeadContent" ContentPlaceHolderID="head" runat="server"></asp:Content>
<asp:Content ID="MainContent" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy" runat="server"></telerik:RadAjaxManagerProxy>
<script type="text/javascript">
    //<![CDATA[
    function OnClientClose(oWnd, args) {
        var ajaxManager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>");
        ajaxManager.ajaxRequest("client");
    }
    //]]>
</script>
 
<telerik:RadWindowManager ID="WindowManager" runat="server" />
 
<telerik:RadSplitter ID="MainRadSplitter" runat="server" Width="100%" Height="100%" LiveResize="True" Orientation="Horizontal">
    <telerik:RadPane ID="MainTopRadPane" runat="server" Height="30px" Scrolling="None"></telerik:RadPane>
    <telerik:RadPane ID="MainMiddleRadPane" runat="server" Scrolling="None">
        <telerik:RadSplitter ID="MainContentRadSplitter" runat="server" Width="100%" Height="100%" LiveResize="True" Orientation="Vertical">
            <telerik:RadPane ID="MainLeftMenuRadPane" runat="server" MinWidth="200" Width="250px" Scrolling="None">               
                <asp:Panel ID="MainLeftMenuPanel" runat="server"></asp:Panel>
                <div id="test" runat="server"></div>
            </telerik:RadPane>
            <telerik:RadSplitBar ID="MainMiddleRadSplitBar" runat="server" CollapseMode="Forward"></telerik:RadSplitBar>
            <telerik:RadPane ID="MainContentRadPane" runat="server" Scrolling="None">
            </telerik:RadPane>
        </telerik:RadSplitter>
    </telerik:RadPane>
</telerik:RadSplitter>
</asp:Content>
so i got request in:
protected void AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
        {
            RadAjaxManager manager = RadAjaxManager.GetCurrent(Page);
            manager.Alert("test");
            test.InnerHtml = "test";
        }
Alert is working fine, but i cant change any control  on the site, and id like to load into MainLeftMenuPanel a UserControl, not only this, because ill need to load 3 diffrent controls into 3 diffrent panels or divs
Dimo
Telerik team
 answered on 27 Oct 2010
1 answer
77 views
Hey guys,

i have the following scenario.

I have an RadListView with about 10 pages. Each item in the ListView is clickable and linked to a new page with detailed information.

Let`s say i am currently on page 6 and click on an item. A new site with detailed information about this item appears in my browser.

Now i want to get back and click on the browser back-button. The ListView is appearing again but now i am not on page 6 where i clicked the item rather i am on page 1 of my ListView again.

Is there an possibility that the ListView can remember the page where i clicked my item and jump back automatically or do i have to store the page in the session and restore it manually to the ListView?

I am using RadDataPager and RadListView.

Thanks in advance.

Christ 
Dimo
Telerik team
 answered on 27 Oct 2010
1 answer
93 views
Hi,

I am unable to align the checkbox column of Templatecolumn to center in the Telerik grid column. Checkbox column is the first column and i am unable to make it center.
Please find the bellow code

<telerik:GridTemplateColumn UniqueName="ChkTmpColumn" HeaderText="Chk1" AllowFiltering="false" Resizable = "false" Reorderable = "false" >
                                                        <HeaderTemplate>                                                       
                                                            <asp:CheckBox ID="hdrChkTmpColumn" AutoPostBack="false" runat="server" ></asp:CheckBox>
                                                        </HeaderTemplate>
                                                        <ItemTemplate>                                                          
                                                            <asp:CheckBox ID="ChkTmpColumnSearch" AutoPostBack="false" runat="server" ></asp:CheckBox>
                                                        </ItemTemplate>
                                                        <HeaderStyle Width="50px"  HorizontalAlign="Center"  VerticalAlign="Middle" /> 
                                                        <ItemStyle  HorizontalAlign="Center" VerticalAlign="Middle" /> 

                                                    </telerik:GridTemplateColumn>


Please view the attached screen shot for further reference.
Thanks in advance.

Pavlina
Telerik team
 answered on 27 Oct 2010
1 answer
54 views
I have seen the examples but have had some trouble implementing them.  I need to know how to put a grid in edit mode similar to excel for non readonly columns in a grid with gridboundcolumns.

Thanks
Dimo
Telerik team
 answered on 27 Oct 2010
2 answers
164 views
So I have been working with RadTreeView and it's context menu with succes, to test if it could solve a problem of mine. Next problem  was that the RadTreeNodes could not contain enough information, so I created my own TreeNodes, and extended those to RadTreeNode. I could create and add the new Nodes to the RadTreeNode without any problems.

But when I tested my treeview, it's showed all nodes i added. When i rightclick the contextmenu pops up, but when clicking on any menuitem, the OnContextMenuItemClick event is not fired. I tried remove all of my nodes, and only add one original RadTreeNode. This works.

I found out that the problem also affects OnNodeDrop and OnNodeEdit events.

It sounds like using costum nodes corrupts some event system. Is this true?

Here are my code snippets:

Custom node:
public class ReportTreeNode : RadTreeNode
    {
        public ReportTreeNode(String text) : base(text)
        {
            Locked = false;
        }
 
        public ReportTreeNode(String text, String value) : base(text, value)
        {
            Locked = false;
        }
 
        public ReportTreeNode(String text, String value, String image)
            : base(text, value)
        {
            Locked = false;
            ImageUrl = image;
        }
 
        public ReportTreeNode(String text, String value, String image, String type)
            : base(text, value)
        {
            NodeType = type;
            Locked = false;
            ImageUrl = image;
        }
 
        public bool Locked { get; set;}
 
        /// <summary>
        /// The report node type. eg. Section, textarea, pagebreak etc.
        /// </summary>
        public String NodeType { get; set; }
 
        /// <summary>
        /// Returns the depth location of the node
        /// </summary>
        /// <returns></returns>
        public int getDepthOfNode()
        {
            int result = 0;
            foreach (char c in FullPath)
            {
                if (c == '/')
                    result++;
            }
            return result;
        }
    }


TreeView:
<telerik:RadScriptManager ID="scriptmanager" runat="server" />
        <telerik:RadAjaxLoadingPanel  ID="RadAjaxLoadingPanel1" runat="server" ><img src="anidog2.gif" /></telerik:RadAjaxLoadingPanel>
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
            <asp:Literal ID="statusMessage" runat="server"></asp:Literal><br />
            <telerik:RadTreeView ID="template" runat="server" EnableDragAndDrop="true" EnableDragAndDropBetweenNodes="true"
            OnContextMenuItemClick="dynamicMenu_ContextMenuItemClick" OnNodeDrop="dynamicMenu_OnNodeDrop" OnNodeEdit="dynamicMenu_OnNodeEdit" AllowNodeEditing="true" OnLoad="templateOnInit">
                <ContextMenus>
                    <telerik:RadTreeViewContextMenu>
                        <Items>
                            <telerik:RadMenuItem Text="Add" Value="none" ImageUrl="application_add.png">
                                <Items>
                                    <telerik:RadMenuItem Text="Section" Value="add:section" ImageUrl="section.png"/>
                                    <telerik:RadMenuItem Text="Textarea" Value="add:textarea" ImageUrl="testArea.png"/>
                                </Items>
                            </telerik:RadMenuItem>
                            <telerik:RadMenuItem Text="Add Custom Section" Value="addCustom" ImageUrl="application_add.png" runat="server" />
                            <telerik:RadMenuItem Text="Delete" Value="delete" ImageUrl="application_delete.png" runat="server" />
                        </Items>
                    </telerik:RadTreeViewContextMenu>
                </ContextMenus>
            </telerik:RadTreeView>
        </telerik:RadAjaxPanel>



And here I add a node to the treeview:
protected void templateOnInit(object sender, EventArgs e)
        {
            if(IsPostBack)
                return;
            template.Nodes.Clear();
 
            ReportTreeNode report = new ReportTreeNode("Report", "report", picturepath + "/report.png", "report");
            report.Locked = true;
            template.Nodes.Add(report);
            return;
        }

if anyone have an answer to this, I would be happy.
Kasper Lindgaard
Top achievements
Rank 1
 answered on 27 Oct 2010
3 answers
148 views
How do I get the Primary Key of the row in which a radio button is selected. I have tried:

   Protected Sub rbt_VehicleImage_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
    
        Dim item As GridDataItem = DirectCast(TryCast(sender, RadioButton).NamingContainer, GridDataItem)
        Dim rdBtn As RadioButton = TryCast(sender, RadioButton)   
  
        If rdBtn.Checked = True Then
  
            Dim sql As String
            Dim strConnString As [String] = System.Configuration.ConfigurationManager.ConnectionStrings("CF_SQL_Connection").ConnectionString()
            sql = "UPDATE CF_Images SET DefaultImage = @Value WHERE IDVehicles = 175"
            Dim connection As New SqlConnection(strConnString)
            Dim command As New SqlCommand(sql, connection)
  
            command.Parameters.Add("@Value", SqlDbType.Int).Value = "0"
            command.Connection.Open()
            command.ExecuteNonQuery()
            command.Connection.Close()
  
            Dim sql1 As String
            Dim strConnString1 As [String] = System.Configuration.ConfigurationManager.ConnectionStrings("CF_SQL_Connection").ConnectionString()
            sql1 = "UPDATE CF_Images SET DefaultImage = @Value WHERE IDVehicles = 175 AND IDImages = @IDImages"
            Dim connection1 As New SqlConnection(strConnString1)
            Dim command1 As New SqlCommand(sql1, connection1)
  
            command1.Parameters.Add("@Value", SqlDbType.Int).Value = "1"
            command1.Parameters.Add("@IDImages", SqlDbType.Int).Value = 333
            command1.Connection.Open()
            command1.ExecuteNonQuery()
            command1.Connection.Close()

            Dim ID As GridBoundColumn = DirectCast(rg_VehicleImages.MasterTableView.GetColumn("IDImages"), GridBoundColumn)
            Dim ID2 As String = Convert.ToString(ID)
            Label1.Text = ID2
  
        Else
  
        End If
  
    End Sub
End Class

However the IDImages value is empty.

ANy help appreciated.
Maria Ilieva
Telerik team
 answered on 27 Oct 2010
3 answers
158 views
Hi, I have a date field, timepicker field.
When i open the timepicker popup, it hides the popup if i click anywhere else than the calendar Icon of the date field (both popups are shown, they overlap because of the space constraint).

Any help on how to hide the timepicker popup, on click of the calendar icon

regards,
Naresh
Dimo
Telerik team
 answered on 27 Oct 2010
3 answers
136 views
i want to increase height and width of editor using javascript.
i tried it using 
var RadEditor2_contentIframe = getObject("RadEditor2_contentIframe")
and then increasing height of RadEditor2_contentIframe using javascript.
it is working fine for me in all the browsers. but when i m switching between the modes like design, code and preview my window size shrinks in IE n chrome.
i tried var RadEditor2_contentArea = $find(radEditorClientId).get_contentArea(), but still result is same.

thanks
    
Rumen
Telerik team
 answered on 27 Oct 2010
2 answers
247 views
Hi All,

I (may) have a problem with an application containing a radgrid.
Because I do not know the number of columns at designtime, I declared the radgrid in the aspx file without columns, and build the grid structure in the code behind (In the NeedDataSource() event after data is fetched from the database).

In order to create 3 footerrows, my plan was to create a footertemplate, but I have read that this must be done in the page_init event.
During page_init however, I do not know the number of columns to create .... so I was stuck here.

I may have found a solution that works (Inspired from another thread about 2 HeaderRows).
During Grid.PreRender i add additional footerrows. It seems to work ok, but I am not sure if this is reliable.

Any comments ?

Thanks.
 
Here is the code:
 
Protected Sub Grid_TimeSheet_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Grid_TimeSheet.PreRender
    AddFooterRow(1)
    AddFooterRow(2)
End Sub
 
Protected Sub AddFooterRow(ByVal marker As Integer)
    ' get the current footer
    Dim footer As GridItem() = Grid_TimeSheet.MasterTableView.GetItems(GridItemType.Footer)
    ' get the current TFoot element
    Dim foot As GridTFoot = CType(footer(0).Parent.Controls(0).Parent, GridTFoot)
    Dim LastFooterPos As Integer = 0
 
    For n = 0 To foot.Controls.Count - 1
        If TypeOf (foot.Controls(n)) Is GridFooterItem Then
            LastFooterPos = n
        End If
    Next
    Dim newFooterItem As GridFooterItem = New GridFooterItem(Grid_TimeSheet.MasterTableView, 0, 0)
    PopulateNewFooterItem(newFooterItem, foot.Controls(LastFooterPos), marker)
    foot.Controls.AddAt(LastFooterPos + 1, newFooterItem)
 
End Sub
 
Protected Sub PopulateNewFooterItem(ByVal footer As GridFooterItem, ByVal existingfooter As GridFooterItem, ByVal marker As Integer)
    For Each fc In existingfooter.Cells
        Dim new_fc As TableCell = New TableCell
        new_fc.Text = marker.ToString()
        footer.Cells.Add(new_fc)
    Next
 
End Sub


Jens Olesen
Top achievements
Rank 1
 answered on 27 Oct 2010
3 answers
161 views
We have a telerik popup window with text fieds and Save/Cancel buttons.

We have these issues:

1. If I press enter key it takes back to the parent window
2. If I set default button to panel, either Save or Cancel is working

Ex:

I have telerik popup window with Save set as default button to the panel.

Upon hitting enter key when focus is on Save button the record is saved.

Upon hitting enter key when focus is on Cancel button the popup window is to be closed, but it is saved!

Any workaround please?!

Thank you

Regards
Raj
Georgi Tunev
Telerik team
 answered on 27 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?