Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
141 views
I'm using two ObjectDataSources with a RadGrid that has a MasterTableView and one DetailTable.  AllowAutomaticDeletes is true for both tables and the ObjectDataSource has the correct DeleteMethod defined as well as DeleteParameters.  It just isn't working.

We're using 2008 Q1 RadControls, and this method works fine in a MasterTableView on another page.  I just can't figure out why it's not working for the DetailTable.

Here is aspx page:
<%@ Page Language="C#" MasterPageFile="~/Intranet.master" AutoEventWireup="true" CodeFile="SummaryAdmin.aspx.cs" Inherits="Mercer.Intranet.Feedback.UpwardFeedback.SummaryAdmin" Title="Upward Feedback" Theme="BasicBlue" %> 
 
<asp:Content ID="Content1" ContentPlaceHolderID="content" runat="Server"
 
    <script type="text/javascript"
        function ShowEditForm(fid) { 
            window.radopen("EditFeedback.aspx?FeedbackID=" + fid, "EditFeedback"); 
            return false; 
        } 
        function refreshGrid(arg) { 
            if (!arg) { 
                window["<%= UpwardFeedbackGrid.ClientID %>"].AjaxRequest('<%= UpwardFeedbackGrid.UniqueID %>', 'Rebind'); 
            } 
            else { 
                window["<%= UpwardFeedbackGrid.ClientID %>"].AjaxRequest('<%= UpwardFeedbackGrid.UniqueID %>', 'RebindAndNavigate'); 
            } 
        } 
    </script> 
 
    <asp:HyperLink ID="MainMenu" runat="server" NavigateUrl="~/Feedback/UpwardFeedback/Default.aspx" CssClass="NavButton">Main Menu</asp:HyperLink> 
    <hr /> 
    <telerik:RadWindowManager ID="myWinMgr" runat="server" Behavior="Move" EnableTheming="true" Modal="true" SkinsPath="~/App_Themes/RadControls/Window/Skins/" Skin="Outlook"
        <Windows> 
            <telerik:RadWindow ID="EditFeedback" runat="server" DestroyOnClose="false" Height="600px" Width="600px" /> 
        </Windows> 
    </telerik:RadWindowManager> 
    <telerik:RadGrid ID="UpwardFeedbackGrid" runat="server" DataSourceID="odsRevieweeRequestSummaryData" Skin="Mercer" EnableAJAXLoadingTemplate="True" LoadingTemplateTransparency="25" EnableAJAX="True" AutoGenerateColumns="False" AllowPaging="true" PageSize="25" AllowFilteringByColumn="true" AllowSorting="true" OnPreRender="UpwardFeedbackGrid_PreRender" OnItemCreated="UpwardFeedbackGrid_ItemCreated" AllowMultiRowSelection="True"
        <HeaderStyle CssClass="DataGridHeader" /> 
        <AJAXLoadingTemplate> 
            <div style="width: 100%; height: 100%;"
                <img src="../../Images/ajax-loader.gif" alt="Loading..." style="vertical-align: middle; text-align: center" /> 
            </div> 
        </AJAXLoadingTemplate> 
        <PagerStyle CssClass="PagerPanel ScreenOnly" Mode="NextPrevNumericAndAdvanced" /> 
        <MasterTableView DataSourceID="odsRevieweeRequestSummaryData" BorderColor="DarkGray" BorderStyle="Solid" BorderWidth="1px" GridLines="Both" Width="750px" DataKeyNames="RevieweeID" AllowAutomaticDeletes="True"
            <AlternatingItemStyle BackColor="#FEF1C5" HorizontalAlign="Center"></AlternatingItemStyle> 
            <HeaderStyle CssClass="CCMenuHeader" HorizontalAlign="Center" VerticalAlign="Middle" Wrap="false" /> 
            <ItemStyle HorizontalAlign="Center" /> 
            <Columns> 
                <telerik:GridBoundColumn DataField="SortName" UniqueName="SortName" HeaderText="Reviewee" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains"
                    <HeaderStyle CssClass="CCMenuHeader" HorizontalAlign="Center" VerticalAlign="Middle" /> 
                    <ItemStyle HorizontalAlign="Left" Wrap="false" /> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="RankName" UniqueName="RankName" HeaderText="Rank" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains"
                    <HeaderStyle CssClass="CCMenuHeader" HorizontalAlign="Center" VerticalAlign="Middle" /> 
                    <ItemStyle HorizontalAlign="Left" Wrap="false" /> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="OfficeName" UniqueName="OfficeName" HeaderText="Office" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains"
                    <HeaderStyle CssClass="CCMenuHeader" HorizontalAlign="Center" VerticalAlign="Middle" /> 
                    <ItemStyle HorizontalAlign="Left" Wrap="false" /> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="BusinessUnitCode" UniqueName="BusinessUnitCode" HeaderText="Business Unit" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains"
                    <HeaderStyle CssClass="CCMenuHeader" HorizontalAlign="Center" VerticalAlign="Middle" /> 
                    <ItemStyle HorizontalAlign="Left" Wrap="false" /> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="RequestCount" UniqueName="RequestCount" HeaderText="# of<br />Requests" AutoPostBackOnFilter="true" CurrentFilterFunction="GreaterThanOrEqualTo"
                    <HeaderStyle CssClass="CCMenuHeader" HorizontalAlign="Center" VerticalAlign="Middle" /> 
                    <ItemStyle HorizontalAlign="Center" /> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="CompletedCount" UniqueName="CompletedCount" HeaderText="# of<br />Completed" AutoPostBackOnFilter="true" CurrentFilterFunction="GreaterThanOrEqualTo"
                    <HeaderStyle CssClass="CCMenuHeader" HorizontalAlign="Center" VerticalAlign="Middle" /> 
                    <ItemStyle HorizontalAlign="Center" /> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="InSummaryCount" UniqueName="InSummaryCount" HeaderText="# in<br />Summary" AutoPostBackOnFilter="true" CurrentFilterFunction="GreaterThanOrEqualTo"
                    <HeaderStyle CssClass="CCMenuHeader" HorizontalAlign="Center" VerticalAlign="Middle" /> 
                    <ItemStyle HorizontalAlign="Center" /> 
                </telerik:GridBoundColumn> 
                <telerik:GridTemplateColumn UniqueName="SummaryLinkColumn" HeaderText="Create/Edit<br />Summary" ItemStyle-HorizontalAlign="Center" AllowFiltering="false"
                    <ItemTemplate> 
                        <asp:HyperLink ID="SummaryLink" runat="server" ImageUrl="~/Images/Icons/wi0060-16.gif" NavigateUrl='<%# "SummaryEdit.aspx?SummaryID=" + Eval("SummaryID").ToString() + "&RevieweeID=" + Eval("RevieweeID").ToString() %>' Text="Create/Edit Summary"></asp:HyperLink> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
            </Columns> 
            <SortExpressions> 
                <telerik:GridSortExpression FieldName="SortName" /> 
            </SortExpressions> 
            <ExpandCollapseColumn Visible="False"
                <HeaderStyle Width="19px"></HeaderStyle> 
            </ExpandCollapseColumn> 
            <RowIndicatorColumn Visible="False"
                <HeaderStyle Width="20px"></HeaderStyle> 
            </RowIndicatorColumn> 
            <DetailTables> 
                <telerik:GridTableView DataSourceID="odsReviewerDetail" DataKeyNames="RevieweeID, ReviewerID, CompanyID, FeedbackID" BorderColor="LightGray" BorderStyle="Solid" BorderWidth="2px" GridLines="Both" Width="100%" AllowAutomaticDeletes="True"
                    <ParentTableRelation> 
                        <telerik:GridRelationFields DetailKeyField="RevieweeID" MasterKeyField="RevieweeID"></telerik:GridRelationFields> 
                    </ParentTableRelation> 
                    <AlternatingItemStyle BackColor="#FEF1C5" HorizontalAlign="Center"></AlternatingItemStyle> 
                    <HeaderStyle CssClass="CCMenuHeader" HorizontalAlign="Center" VerticalAlign="Middle" Wrap="false" /> 
                    <ItemStyle HorizontalAlign="Center" /> 
                    <Columns> 
                        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" ConfirmText="You are about to delete this Request/Feedback.  Are you sure?" UniqueName="Delete" Text="Delete this Request/Feedback" ImageUrl="~/Images/Icons/deletedata16.gif"
                            <HeaderStyle HorizontalAlign="Center" /> 
                            <ItemStyle HorizontalAlign="Center" /> 
                        </telerik:GridButtonColumn> 
                        <telerik:GridBoundColumn DataField="FeedbackID" UniqueName="FeedbackID" HeaderText="FeedbackID" Visible="false"
                        </telerik:GridBoundColumn> 
                        <telerik:GridTemplateColumn UniqueName="EditFeedback"
                            <ItemStyle HorizontalAlign="Center" /> 
                            <ItemTemplate> 
                                <asp:HyperLink ID="EditFeedbackLink" runat="server" ImageUrl="~/Images/Icons/wi0060-16.gif" NavigateUrl="EditFeedback.aspx" Text="Edit Feedback"></asp:HyperLink> 
                            </ItemTemplate> 
                        </telerik:GridTemplateColumn> 
                        <telerik:GridBoundColumn DataField="ReviewerName" UniqueName="ReviewerName" HeaderText="Reviewer"
                            <ItemStyle HorizontalAlign="Left" Wrap="false" /> 
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="CompanyName" UniqueName="CompanyName" HeaderText="Client"
                            <ItemStyle HorizontalAlign="Left" Wrap="false" /> 
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="RequestDate" UniqueName="RequestDate" HeaderText="Requested" DataFormatString="{0:MMM dd, yyyy}"
                            <ItemStyle HorizontalAlign="Left" Wrap="false" /> 
                        </telerik:GridBoundColumn> 
                        <telerik:GridTemplateColumn UniqueName="Adhoc"
                            <HeaderTemplate> 
                                Adhoc</HeaderTemplate> 
                            <ItemTemplate> 
                                <%# Eval("Adhoc").ToString() == "True" ? "Yes": "" %> 
                            </ItemTemplate> 
                        </telerik:GridTemplateColumn> 
                        <telerik:GridBoundColumn DataField="SubmitDate" UniqueName="SubmitDate" HeaderText="Submitted" DataFormatString="{0:MMM dd, yyyy}"
                            <ItemStyle HorizontalAlign="Left" Wrap="false" /> 
                        </telerik:GridBoundColumn> 
                        <telerik:GridTemplateColumn UniqueName="InSummary"
                            <HeaderTemplate> 
                                In Summary</HeaderTemplate> 
                            <ItemTemplate> 
                                <%# Eval("InSummary").ToString() == "True" ? "Yes": "" %> 
                            </ItemTemplate> 
                        </telerik:GridTemplateColumn> 
                        <telerik:GridBoundColumn DataField="ReviewerID" UniqueName="ReviewerID" HeaderText="ReviewerID" Visible="false"
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="RevieweeID" UniqueName="RevieweeID" HeaderText="RevieweeID" Visible="false"
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="CompanyID" UniqueName="CompanyID" HeaderText="CompanyID" Visible="false"
                        </telerik:GridBoundColumn> 
                    </Columns> 
                    <SortExpressions> 
                        <telerik:GridSortExpression FieldName="ReviewerName" /> 
                    </SortExpressions> 
                </telerik:GridTableView> 
            </DetailTables> 
        </MasterTableView> 
        <ClientSettings> 
            <Selecting AllowRowSelect="True" /> 
        </ClientSettings> 
    </telerik:RadGrid> 
    <asp:ObjectDataSource ID="odsRevieweeRequestSummaryData" runat="server" TypeName="Mercer.Intranet.Feedback.UpwardFeedback.DataHelp" SelectMethod="GetRevieweeRequestSummaryData"></asp:ObjectDataSource> 
    <asp:ObjectDataSource ID="odsReviewerDetail" runat="server" TypeName="Mercer.Intranet.Feedback.UpwardFeedback.DataHelp" SelectMethod="GetReviewerDetail" DeleteMethod="DeleteRequestAndFeedback"
        <SelectParameters> 
            <asp:Parameter Name="RevieweeID" Type="String" /> 
        </SelectParameters> 
        <DeleteParameters> 
            <asp:Parameter Name="ReviewerID" Type="String" /> 
            <asp:Parameter Name="RevieweeID" Type="String" /> 
            <asp:Parameter Name="CompanyID" Type="String" /> 
            <asp:Parameter Name="FeedbackID" Type="String" /> 
        </DeleteParameters> 
    </asp:ObjectDataSource> 
</asp:Content> 
 


Here is code behind:
using System; 
using System.Data; 
using System.Configuration; 
using System.Collections; 
using System.Web; 
using System.Web.Security; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using System.Web.UI.WebControls.WebParts; 
using System.Web.UI.HtmlControls; 
using System.IO; 
using Mercer.Data; 
using Mercer.Directory; 
using Mercer.Reference; 
using Mercer.Security; 
using Mercer.Intranet.Shared.BaseClasses; 
using Mercer.Intranet.HR; 
using Telerik.WebControls; 
 
 
namespace Mercer.Intranet.Feedback.UpwardFeedback 
    public partial class SummaryAdmin : System.Web.UI.Page 
    { 
        GridSettingsPersister gsp; 
 
        protected override void Render(HtmlTextWriter writer) 
        { 
            Session["UFSummaryAdminSettings"] = gsp.SaveSettings(); 
            base.Render(writer); 
        } 
 
        protected void Page_Init(object sender, EventArgs e) 
        { 
            gsp = new GridSettingsPersister(UpwardFeedbackGrid); 
            if (Session["UFSummaryAdminSettings"] != null
                gsp.LoadSettings(Session["UFSummaryAdminSettings"].ToString()); 
        } 
 
        private static Authenticator ui 
        { 
            get 
            { 
                Authenticator ui = new Authenticator(); 
                return ui; 
            } 
        } 
 
        private static Employee employee 
        { 
            get 
            { 
                Employee employee = new Employee(ui.WhoAmI.EmployeeID); 
                return employee; 
            } 
        } 
 
        private static Identity identity 
        { 
            get 
            { 
                return ui.WhoAmI; 
            } 
        } 
 
        private static bool Admin 
        { 
            get 
            { 
                return DataHelp.IsAdmin(); 
            } 
        } 
 
        private static bool HR 
        { 
            get 
            { 
                return DataHelp.IsHR(); 
            } 
        } 
 
        protected void Page_Load(object sender, EventArgs e) 
        { 
            HtmlLink lnk = new HtmlLink(); 
            HtmlLink prt = new HtmlLink(); 
            lnk.Attributes.Add("rel""stylesheet"); 
            lnk.Attributes.Add("type""text/css"); 
            lnk.Attributes.Add("media""screen"); 
            lnk.Href = "~/HR/Default.css"
            prt.Attributes.Add("rel""stylesheet"); 
            prt.Attributes.Add("type""text/css"); 
            prt.Attributes.Add("media""print"); 
            prt.Href = "~/HR/Print.css"
            HtmlHead head = (HtmlHead)this.Page.Master.FindControl("pageHead"); 
            head.Controls.Add(lnk); 
            head.Controls.Add(prt); 
 
            Master.Page.Title = "Upward Feedback Administration"
            Header myHeader = (Header)Master.FindControl("myHeader"); 
            myHeader.PageTitle = Master.Page.Title; 
            #region Page Authentication 
 
            if (!Admin && !HR) 
                identity.Deny(); 
            #endregion 
        } 
 
        protected void UpwardFeedbackGrid_PreRender(object sender, EventArgs e) 
        { 
            ProcessGridRows(); 
            if (!Admin) 
            { 
                UpwardFeedbackGrid.MasterTableView.Columns.FindByUniqueName("SummaryLinkColumn").Visible = false
                UpwardFeedbackGrid.MasterTableView.Columns.FindByUniqueName("InSummaryCount").Visible = false
                UpwardFeedbackGrid.MasterTableView.DetailTables[0].Columns.FindByUniqueName("EditFeedback").Visible = false
                UpwardFeedbackGrid.MasterTableView.DetailTables[0].Columns.FindByUniqueName("Adhoc").Visible = false
                UpwardFeedbackGrid.MasterTableView.DetailTables[0].Columns.FindByUniqueName("InSummary").Visible = false
                UpwardFeedbackGrid.MasterTableView.DetailTables[0].Columns.FindByUniqueName("DeleteFeedback").Visible = false
            } 
        } 
 
        private void ProcessGridRows() 
        { 
            foreach (GridDataItem gdi in UpwardFeedbackGrid.Items) 
            { 
                if ((gdi as GridDataItem).CanExpand) 
                { 
                    if (Convert.ToInt16(((gdi as GridDataItem)["CompletedCount"as GridTableCell).Text) < 3) 
                    { 
                        (((gdi as GridDataItem)["SummaryLinkColumn"as GridTableCell).Controls[1] as HyperLink).Visible = false
                    } 
                } 
                else 
                { 
                    if (Convert.ToInt16(((gdi as GridDataItem)["FeedbackID"as GridTableCell).Text) == 0) 
                    { 
                        HyperLink EditFeedbackLink = (((gdi as GridDataItem)["EditFeedback"as GridTableCell).Controls[1] as HyperLink); 
                        EditFeedbackLink.Enabled = false
                        EditFeedbackLink.ImageUrl = "~/Images/cleardot.gif"
                        EditFeedbackLink.Height = System.Web.UI.WebControls.Unit.Pixel(16); 
                        EditFeedbackLink.Width = System.Web.UI.WebControls.Unit.Pixel(16); 
 
                    } 
                    if (((gdi as GridDataItem)["SubmitDate"as GridTableCell).Text.Length > 0) 
                        if (Convert.ToDateTime(((gdi as GridDataItem)["SubmitDate"as GridTableCell).Text) == DateTime.Parse("1/1/1900")) 
                        { 
                            ((gdi as GridDataItem)["SubmitDate"as GridTableCell).Text = ""
                        } 
                } 
            } 
        } 
 
        protected void UpwardFeedbackGrid_ItemCreated(object sender, GridItemEventArgs e) 
        { 
            if (e.Item is GridDataItem) 
            { 
                HyperLink editLink = e.Item.FindControl("EditFeedbackLink"as HyperLink; 
                if (editLink != null
                { 
                    editLink.Attributes["href"] = "#"
                    editLink.Attributes["onclick"] = string.Format("return ShowEditForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["FeedbackID"], e.Item.ItemIndex); 
                } 
            } 
        } 
    } 


Thanks in advance for any help,

John Anderson
John Anderson
Top achievements
Rank 1
 answered on 06 Nov 2009
1 answer
154 views
Hi,

I have created a custom skin using the Stylebuilder, based on the Telerik skin. For the Editor I have used the Default skin, so I created a new skin using the Style Builder based on the Default skin for only the Editor control and added these files to my custom Skin file folder.

Everything looks fine in my new skin, except the file overview in the Image Manager of the Editor. There are no styles to this file overview applied at all. Also the Properties tab of the Image Manager has no styling. Check this screenshot.

The styles are correctly applied when I use an Embedded Skin, like Telerik.

Does anybody know why there are no styles applied in the Image Manager window using my custom skin.

Thanx,
Danny
Martin
Telerik team
 answered on 06 Nov 2009
1 answer
173 views

We have astrange behavior on combo box. For example the box has ten items and each itemhas one character, and its width is aligning to bottom of the record label. Soeach item has some empty space. With IE, user couldn’t select an item by clickon the empty space. We found it works fine in Firefox. Thanks

Testing environment:

Telerikversion:2009.2.1014.20

Browser IE7

MS VisionalStudio 2008

Simon
Telerik team
 answered on 06 Nov 2009
1 answer
116 views
Hi

       i am using telerik version-2009.1.402.20 product in my web application.
        I have grid with GridclientSelect column like....

 

      <telerik:GridClientSelectColumn UniqueName="DelSel" HeaderStyle-HorizontalAlign="Center"></telerik:GridClientSelectColumn>


       Based on some condition i make that check box to invisible state.So some row having check box some rows does not .
       What  iam issue is if i select header check box all the row getting selected even if the row is not having check box.
       Also i have multiselect option. what i want is when i am selecting header check box it should select only which are having
      check box in Gid rows.So no need to select all the rows in grid.

Regards,
Abdul Ajees.M

 

Shinu
Top achievements
Rank 2
 answered on 06 Nov 2009
6 answers
173 views
In Charts, is there way to add copyright small message.
Most of the charting provides option to add copyright text in bottom right hand side.
or any other work around ?
Thanks.
kultman
Top achievements
Rank 2
 answered on 06 Nov 2009
3 answers
171 views
I am not sure what bug I have introduced to my code.  I will paste it here for review.  For whatever reason, the delete buttn works only once and only if it is the first item clicked on the page.  After that, nothing happens if it is clicked.

Please help - MY guess is AJAX is interfering.

Imports Telerik.Web.UI  
Imports System.Configuration  
Imports System.Data.SqlClient  
Imports System.Data  
Imports ProfileCommon  
 
Partial Class jobs_view  
    Inherits System.Web.UI.Page  
    Protected Sub btnApply_Click(ByVal sender As ObjectByVal e As System.EventArgs)  
 
        'Check to see if the applicant has already applied for this job  
        For Each item As GridDataItem In RadGrid2.MasterTableView.Items  
           
            Dim curJobID As String = item("JobID").Text.ToString()  
 
            Dim btnApply As Button = DirectCast(sender, Button)  
            Dim di As GridDataItem = DirectCast(btnApply.NamingContainer, GridDataItem)  
            Dim currJobID As String = di("JobID").Text  
            Dim diKeys As GridDataItem = DirectCast(btnApply.NamingContainer, GridDataItem)  
            Dim varJobID As String = diKeys("JobId").Text  
 
 
            If curJobID = varJobID Then 
                RadAjaxManager1.ResponseScripts.Add("radalert('Sorry, you have already applied for this job.', 330, 210);")  
                GoTo EXIT_SUB  
            End If 
 
        Next 
        'Now check to see if the applicant has already applied for than five jobs  
        Dim rowCount As Integer = RadGrid2.MasterTableView.GetItems(New GridItemType() {GridItemType.Item, GridItemType.AlternatingItem}).Length  
        If rowCount >= 5 Then 
 
            RadAjaxManager1.ResponseScripts.Add("radalert('Sorry, you can only apply for five (5) jobs.  Please remove a job from your list and try agian.', 330, 210);")  
            GoTo EXIT_SUB  
        End If 
        'If all is good, insert the job for applicant  
        'Configure SQL Connection  
        Dim cn As SqlConnection = New SqlConnection  
        Dim cmd As SqlCommand = New SqlCommand  
        Dim connString As String = ConfigurationManager.ConnectionStrings("csSSEA").ConnectionString  
        cn.ConnectionString = connString  
        cmd.CommandText = "[usp_UserJobsInsert]" 
        cmd.CommandType = System.Data.CommandType.StoredProcedure  
        cmd.Connection = cn  
 
        'Gets the name if authenticated.  
        Dim CurrentUserName As String 
        If User.Identity.IsAuthenticated Then 
            CurrentUserName = User.Identity.Name  
        Else 
            CurrentUserName = "N/A" 
        End If 
 
        'Get Datagrid Values and declare as sql param      
        Dim btn As Button = DirectCast(sender, Button)  
        Dim dataItem As GridDataItem = DirectCast(btn.NamingContainer, GridDataItem)  
        Dim strJobID As String = dataItem("JobID").Text  
        Dim dataItemKeys As GridDataItem = DirectCast(btn.NamingContainer, GridDataItem)  
        Dim JobID As String = dataItemKeys("JobId").Text  
 
        cmd.Parameters.Add("@UserName", SqlDbType.VarChar).Value = CurrentUserName  
        cmd.Parameters.Add("@JobID", SqlDbType.Int).Value = JobID  
 
        Try 
            If cn.State = ConnectionState.Closed Then 
                cn.Open()  
            End If 
            cmd.ExecuteNonQuery()  
            cn.Close()  
            cn.Dispose()  
        Catch ex As Exception  
        End Try 
        RadGrid2.Rebind()  
EXIT_SUB:  
    End Sub 
End Class 
 
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" 
    CodeFile="view.aspx.vb" Inherits="jobs_view" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">  
</asp:Content> 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">  
    <span class="hdrtext">Available Jobs</span> 
    <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="dsViewJobs" GridLines="None" 
        Skin="Default">  
        <MasterTableView AutoGenerateColumns="False" DataKeyNames="JobID" DataSourceID="dsViewJobs">  
            <RowIndicatorColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
            </RowIndicatorColumn> 
            <ExpandCollapseColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
            </ExpandCollapseColumn> 
            <Columns> 
                <telerik:GridBoundColumn DataField="JobID" DataType="System.Int32" HeaderText="JobID" 
                    ReadOnly="True" SortExpression="JobID" UniqueName="JobID" Visible="False">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="JobTitle" HeaderText="JobTitle" SortExpression="JobTitle" 
                    UniqueName="JobTitle" Visible="False">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="JobFile" HeaderText="JobFile" SortExpression="JobFile" 
                    UniqueName="JobFile" Visible="False">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="PositionQty" DataType="System.Int32" HeaderText="PositionQty" 
                    SortExpression="PositionQty" UniqueName="PositionQty" Visible="False">  
                </telerik:GridBoundColumn> 
                <telerik:GridHyperLinkColumn DataNavigateUrlFields="JobFile" DataTextField="JobTitle" 
                    HeaderText="Job Title" UniqueName="JobFileHyperLink">  
                </telerik:GridHyperLinkColumn> 
                <telerik:GridTemplateColumn HeaderText="Apply" UniqueName="Apply">  
                    <ItemTemplate> 
                        <asp:Button ID="btnApply" runat="server" Text="Apply" OnClick="btnApply_Click" /> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
            </Columns> 
        </MasterTableView> 
    </telerik:RadGrid> 
    <asp:SqlDataSource ID="dsViewJobs" runat="server" ConnectionString="<%$ ConnectionStrings:csSSEA %>" 
        SelectCommand="SELECT * FROM [Jobs] ORDER BY [JobTitle], [PositionQty]" ConflictDetection="CompareAllValues" 
        DeleteCommand="DELETE FROM [Jobs] WHERE [JobID] = @original_JobID AND (([JobTitle] = @original_JobTitle) OR ([JobTitle] IS NULL AND @original_JobTitle IS NULL)) AND (([JobFile] = @original_JobFile) OR ([JobFile] IS NULL AND @original_JobFile IS NULL)) AND [PositionQty] = @original_PositionQty" 
        InsertCommand="INSERT INTO [UserJobs] ([Username], [JobID]) VALUES (@Username, @JobID)" 
        OldValuesParameterFormatString="original_{0}" UpdateCommand="UPDATE [Jobs] SET [JobTitle] = @JobTitle, [JobFile] = @JobFile, [PositionQty] = @PositionQty WHERE [JobID] = @original_JobID AND (([JobTitle] = @original_JobTitle) OR ([JobTitle] IS NULL AND @original_JobTitle IS NULL)) AND (([JobFile] = @original_JobFile) OR ([JobFile] IS NULL AND @original_JobFile IS NULL)) AND [PositionQty] = @original_PositionQty">  
        <DeleteParameters> 
            <asp:Parameter Name="original_JobID" Type="Int32" /> 
            <asp:Parameter Name="original_JobTitle" Type="String" /> 
            <asp:Parameter Name="original_JobFile" Type="String" /> 
            <asp:Parameter Name="original_PositionQty" Type="Int32" /> 
        </DeleteParameters> 
        <UpdateParameters> 
            <asp:Parameter Name="JobTitle" Type="String" /> 
            <asp:Parameter Name="JobFile" Type="String" /> 
            <asp:Parameter Name="PositionQty" Type="Int32" /> 
            <asp:Parameter Name="original_JobID" Type="Int32" /> 
            <asp:Parameter Name="original_JobTitle" Type="String" /> 
            <asp:Parameter Name="original_JobFile" Type="String" /> 
            <asp:Parameter Name="original_PositionQty" Type="Int32" /> 
        </UpdateParameters> 
        <InsertParameters> 
            <asp:ProfileParameter Name="Username" PropertyName="UserName" Type="String" /> 
            <asp:Parameter Name="JobID" DefaultValue="1" Type="Int32" /> 
        </InsertParameters> 
    </asp:SqlDataSource> 
    <br /> 
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" IconUrl="/img/icons/error.png" 
                Skin="Forest" Title="Error">  
                <Windows> 
                <telerik:RadWindow ID="radconfirm" IconUrl="/img/icons/help.png"></telerik:RadWindow>   
                </Windows> 
    </telerik:RadWindowManager> 
    <span class="hdrtext">Jobs You Have Applied For</span> 
 
    <script type="text/javascript">  
        var oldConfirm = radconfirm;  
 
        window.radconfirm = function(text, mozEvent) {  
            var ev = mozEvent ? mozEvent : window.event; //Moz support requires passing the event argument manually        
            //Cancel the event        
            ev.cancelBubble = true;  
            ev.returnValue = false;  
            if (ev.stopPropagation) ev.stopPropagation();  
            if (ev.preventDefault) ev.preventDefault();  
 
            //Determine who is the caller        
            var callerObj = ev.srcElement ? ev.srcElement : ev.target;  
 
            //Call the original radconfirm and pass it all necessary parameters        
            if (callerObj) {  
                //Show the confirm, then when it is closing, if returned value was true, automatically call the caller's click method again.        
                var callBackFn = function(arg) {  
                    if (arg) {  
                        callerObj["onclick"] = "";  
                        if (callerObj.click) callerObj.click(); //Works fine every time in IE, but does not work for links in Moz        
                        else if (callerObj.tagName == "A") //We assume it is a link button!        
                        {  
                            try {  
                                eval(callerObj.href)  
                            }  
                            catch (e) { }  
                        }  
                    }  
                }  
                oldConfirm('Are you sure you want to delete this job from your application?', callBackFn, 300, 100, null,'Delete Confirmation');  
            }  
            return false;  
        }       
    
    </script> 
 
    <telerik:RadGrid ID="RadGrid2" runat="server" DataSourceID="dsViewJobsAppliedFor" 
        GridLines="None" Skin="Default">  
        <MasterTableView AutoGenerateColumns="False" DataKeyNames="UserJobID" DataSourceID="dsViewJobsAppliedFor" 
            AllowAutomaticDeletes="True">  
            <RowIndicatorColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
            </RowIndicatorColumn> 
            <ExpandCollapseColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
            </ExpandCollapseColumn> 
            <Columns> 
                <telerik:GridBoundColumn DataField="username" HeaderText="username" SortExpression="username" 
                    UniqueName="username" Visible="False">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="UserJobID" DataType="System.Int32" HeaderText="UserJobID" 
                    SortExpression="UserJobID" UniqueName="UserJobID" ReadOnly="True" Visible="False">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="JobID" DataType="System.Int32" HeaderText="JobID" 
                    SortExpression="JobID" UniqueName="JobID" Visible="False">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="JobTitle" HeaderText="JobTitle" SortExpression="JobTitle" 
                    UniqueName="JobTitle" Visible="False">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="JobFile" HeaderText="JobFile" SortExpression="JobFile" 
                    UniqueName="JobFile" Visible="False">  
                </telerik:GridBoundColumn> 
                <telerik:GridHyperLinkColumn DataNavigateUrlFields="JobFile" DataTextField="JobTitle" 
                    HeaderText="Job Title" UniqueName="column">  
                </telerik:GridHyperLinkColumn> 
                <%--<telerik:GridButtonColumn ButtonType="PushButton" CommandName="Delete"   
            Text="Delete" UniqueName="Delete" HeaderText="Delete"   
            ConfirmText="Are you sure you want to delete this job from your application?" > 
        </telerik:GridButtonColumn>--%> 
                <telerik:GridTemplateColumn UniqueName="DeleteColumn" HeaderText="Delete">  
                    <%-- <HeaderTemplate>    
                                <table width="100%">     
                                    <tr>    
                                        <td style="width:50%">     
                                            RadConfirm</td>    
                                        <td style="width:50%">     
                                            Default confirm</td>    
                                    </tr>    
                                </table>    
                            </HeaderTemplate>--%> 
                    <ItemTemplate> 
                        <asp:Button ID="btnDelete" ToolTip="Delete Record" runat="server" CausesValidation="False" 
                            Text="Delete" CommandName="Delete" OnClientClick="return radconfirm('Are you sure you want to delete this record?', event);" /> 
                        <%--<table width="100%">     
                                    <tr>    
                                        <td>    
                                            </td>     
                                        <td>    
                                            <asp:ImageButton ID="ImageButton1" ToolTip="Delete Record" runat="server" CausesValidation="False"    
                                                CommandName="Delete" OnClientClick="return confirm('Are you sure you want to delete this record?');"    
                                                ImageUrl="~/RadControls/Grid/Skins/Default/Delete.gif" />    
                                        </td>    
                                    </tr>    
                                </table>--%> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
            </Columns> 
            <EditFormSettings> 
                <EditColumn ButtonType="ImageButton">  
                </EditColumn> 
            </EditFormSettings> 
        </MasterTableView> 
    </telerik:RadGrid> 
    <asp:SqlDataSource ID="dsViewJobsAppliedFor" runat="server" ConflictDetection="CompareAllValues" 
        ConnectionString="<%$ ConnectionStrings:csSSEA %>" DeleteCommand="DELETE FROM [UserJobs] WHERE [userjobid] = @original_userjobid" 
        InsertCommand="INSERT INTO [UserJobs] ([Username], [JobID]) VALUES (@Username, @JobID)" 
        OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT uj.username, uj.UserJobID, uj.JobID, j.JobTitle, j.JobFile FROM UserJobs uj, Jobs j WHERE ([Username] = @UserName) and uj.jobid = j.jobid" 
        UpdateCommand="UPDATE [UserJobs] SET [Username] = @Username, [JobID] = @JobID WHERE [id] = @original_id AND [Username] = @original_Username AND [JobID] = @original_JobID">  
        <SelectParameters> 
            <asp:ProfileParameter Name="Username" PropertyName="UserName" Type="String" /> 
        </SelectParameters> 
        <DeleteParameters> 
            <asp:Parameter Name="original_userjobid" Type="Int32" /> 
            <asp:Parameter Name="original_Username" Type="String" /> 
            <asp:Parameter Name="original_JobID" Type="Int32" /> 
        </DeleteParameters> 
        <UpdateParameters> 
            <asp:Parameter Name="Username" Type="String" /> 
            <asp:Parameter Name="JobID" Type="Int32" /> 
            <asp:Parameter Name="original_id" Type="Int32" /> 
            <asp:Parameter Name="original_Username" Type="String" /> 
            <asp:Parameter Name="original_JobID" Type="Int32" /> 
        </UpdateParameters> 
        <InsertParameters> 
            <asp:Parameter Name="Username" Type="String" /> 
            <asp:Parameter Name="JobID" Type="Int32" /> 
        </InsertParameters> 
    </asp:SqlDataSource> 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadGrid1">  
              
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" /> 
                    <telerik:AjaxUpdatedControl ControlID="RadGrid2" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManager> 
</asp:Content> 
 
Sebastian
Telerik team
 answered on 06 Nov 2009
1 answer
142 views

Hi,

 I am able to open our custom RadDock windowfor creating appointment. But it takes long time to open the RadDock. I amtrying to open a RadDock window from server side code.


Any idea let me know any ways to making it quicker/faster?.

Thanks

Sabarish

Obi-Wan Kenobi
Top achievements
Rank 1
 answered on 06 Nov 2009
1 answer
164 views
I have created the following stacked column charts (please see sample.jpg in the attachment).

1. How can I avoid overlapping labels (top chart)
2. How can I place each label inside the according bar panel and not above it and two labels in the top stack (bottom chart)

Thanks for your help!

Meanwhile I have solved issue #2 by setting the AxisMode to Extended:

chart.PlotArea.YAxis.AxisMode =

ChartYAxisMode.Extended;

(Still looking for a solution for #1. In my opinion that should be solved with the AutoLayout setting. But it does not. A bug?)

 

 

Ves
Telerik team
 answered on 06 Nov 2009
7 answers
186 views
Hi,

I need to have tree with 'Closed folder' and 'open folder' image instead of '+' and '-' icons in the tree. I tried doing this by changing rptPlus and rptMinus but here on mouse hover the image is getting disappered.

I want a solution for this.... :(....
I am in the middle of my requirement implementation where i cant go back to old asp tree control only for this image display issue.

I hope someone should help in this....

Regards,
Medac
Yana
Telerik team
 answered on 06 Nov 2009
1 answer
137 views

Hi,

I am implementing a horizontal bar chart drawing out how many times different links are clicked.
The problem is that the labels are not aligned properly. They show up in 2 or 3 columns and alternate between them.
Let say I have bars with equal length and it shows up as such:

bar 2
bar    2
bar 2
bar    2

I have tried setting labelLocation to inside or outside and other settings as well but it did not work.

Another problem is that I want to set the yAxis steps(now horizontal) to integer values because it does not make sense to have decimal places. How do I adjust the steps to jump by exactly 1 instead of 0.2 without specifying the maxvalues, min values etc because I do not know these values.  I tried setting LabelSteps to 5 but it only solves the problem for this chart. Is there a better way to do it?

Any help will be greatly appreciated.

My entire code is as such:

namespace TelerikTest  
{  
    public partial class _Default : System.Web.UI.Page  
    {  
        protected void Page_Load(object sender, EventArgs e)  
        {  
            //Chart Appearance   
            chartControl.PlotArea.Appearance.Border.Visible = false;  
          
            chartControl.IntelligentLabelsEnabled = true;  
            chartControl.AutoTextWrap = true;  
            chartControl.AutoLayout = true;  
            chartControl.SeriesOrientation = Telerik.Charting.ChartSeriesOrientation.Horizontal;  
 
            //Telerik bug: AutoScale will change xAxis Item label to 1.2.3.4.5....  
            chartControl.PlotArea.XAxis.AutoScale = false;  
 
            chartControl.Width = 800;  
            chartControl.Legend.Visible = false;  
            //chartControl.Legend.Appearance.Position.Auto = false;  
            chartControl.PlotArea.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Top;    
   
            Dictionary<string,int> items = new Dictionary<string,int>();  
            items.Add("First",1);  
            items.Add("Second",2);  
 
            for (int i = 0; i < 40; i++)  
            {  
                items.Add("http://testing1testing2testing3testing4.com" + i, 1);  
                int height = (int)chartControl.Height.Value;  
                chartControl.Height = height + 15;  
 
            }  
            loadBar("",items);  
        }  
 
        protected void loadBar(string seriesName, Dictionary<string,int> segments)  
        {  
            ChartSeries s = new ChartSeries(seriesName, ChartSeriesType.Bar);  
            int c = 0;  
            foreach (string segmentName in segments.Keys)  
            {  
                int segmentValue = segments[segmentName];  
                s.AddItem(segmentValue);  
                s.Items[c].Name = segmentName;  
                c++;  
            }  
            s.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels;  
            s.DefaultLabelValue = "#Y";  
            s.Appearance.LabelAppearance.Position.Auto = false;  
            s.Appearance.LabelAppearance.LabelLocation = Telerik.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Auto;  
            
            loadRadChart("chartTitle", s);  
        }  
 
        public void loadRadChart(string chartTitle, ChartSeries chartSeries)  
        {  
            chartControl.Clear();  
            chartControl.PlotArea.XAxis.Clear();  
 
            chartControl.ChartTitle.TextBlock.Text = chartTitle;  
 
            chartControl.Series.Add(chartSeries);  
 
            foreach (ChartSeriesItem item in chartSeries.Items)  
            {  
                if (item.YValue == 0.0) { item.Label.Visible = false; }  
                chartControl.PlotArea.XAxis.AddItem(item.Name);  
            }  
            chartControl.PlotArea.YAxis.LabelStep = 5;  
        }   
 
    }  
}  
 
Velin
Telerik team
 answered on 06 Nov 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?