| 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 Object, ByVal 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> |
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
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?)
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; |
| } |
| } |
| } |
Hi.....
How To Compare Two Excell File in RadGrid Any Option Is There using Teleriks RadGrid?
Thanks & Regards
Karthik
if
(e.Value != string.Empty)
{
txtItemDescription.Text =
string.Empty;
hdnItemNumber.Value = e.Value;
if (e.Value != string.Empty)
{
foreach (DataRow dr in GetItem(e.Value.Trim()).Rows)
{
txtItemDescription.Text = dr[
"Description"].ToString();
break;
}
}
}
Here is my ASP.NET code:
<
table border="0" cellpadding="2">
<tr>
<td valign="top">
<asp:HiddenField ID="hdnItemMode" runat="server" />
Item Number:
</td>
<td valign="top">
<telerik:RadComboBox runat="server" ID="rcbItemNumber" AllowCustomText="True" EnableItemCaching="True"
EnableLoadOnDemand="True" EnableVirtualScrolling="True" OnSelectedIndexChanged="rcbItemNumber2_SelectedIndexChanged"
DataTextField="ItemNumber" DataValueField="ItemNumber" OnItemsRequested="rcbItemNumber_ItemsRequested"
MaxHeight="180px" CausesValidation="false" ShowMoreResultsBox="True" ShowWhileLoading="False"
AutoPostBack="True">
</telerik:RadComboBox>
<asp:HiddenField ID="hdnItemNumber" runat="server" Value='<%# Bind("ItemNumber") %>' />
<asp:Label ID="lblItemsFound" runat="server" ForeColor="Red"></asp:Label>
</td>
<td valign="top">
Description:
</td>
<td valign="top">
<asp:TextBox class="textbox" ID="txtItemDescription" Width="250px" Text='<%# Bind( "ItemDescription") %>'
TextMode="MultiLine" Rows="4" runat="server"></asp:TextBox>
</td>
</tr>
< tr>
<td>
Qty:
</td>
<td>
<asp:TextBox class="textbox" ID="txtQty" Width="150px" runat="server"></asp:TextBox>
</td>
<td>
Price:
</td>
<td valign="middle">
<asp:TextBox ID="txtPrice" runat="server" class="textbox" Width="150px"></asp:TextBox>
</td>
</tr>
</table>
