or
<telerik:RadAjaxManager ID="RadAjaxManager2" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1"> <ClientEvents OnRequestStart="RequestStart" OnResponseEnd="RequestEnd"></ClientEvents> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="Panel1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="Panel1" LoadingPanelID="RadAjaxLoadingPanel1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings></telerik:RadAjaxManager><asp:Panel ID="Panel1" runat="server" > <telerik:RadGrid ID="GriEleRec" runat="server" AllowAutomaticUpdates="True" AllowPaging="True" AutoGenerateEditColumn="True" DataSourceID="MySQLDataSource" GridLines="None" Skin="Web20" PageSize="12" AllowAutomaticDeletes="True" AutoGenerateColumns="False" style="margin-right: 23px" Width="100%" OnInsertCommand="InsRep" OnDeleteCommand="DelRep" OnUpdateCommand="UpdRep" AutoGenerateDeleteColumn="True" AllowSorting="True"> ....... ...... </telerik:RadGrid><script language="javascript" type="text/javascript"> var currentLoadingPanel = null; function RequestStart(sender, eventArgs) { check = InStr(eventArgs.EventTarget, "btnEli"); //alert(check); if (check > 0) { eventArgs.EnableAjax = false; } else { eventArgs.EnableAjax = true; centerElementOnScreen($get("<%= RadAjaxLoadingPanel1.ClientID %>")); HideFrame(); } } function RequestEnd(sender, eventArgs) { ShowFrame(); } function centerElementOnScreen(element) { var scrollTop = document.body.scrollTop; var scrollLeft = document.body.scrollLeft; var viewPortHeight = document.body.clientHeight; var viewPortWidth = document.body.clientWidth; if (document.compatMode == "CSS1Compat") { viewPortHeight = document.documentElement.clientHeight; viewPortWidth = document.documentElement.clientWidth; scrollTop = document.documentElement.scrollTop; scrollLeft = document.documentElement.scrollLeft; } var topOffset = Math.ceil(viewPortHeight / 2 - element.offsetHeight / 2); var leftOffset = Math.ceil(viewPortWidth / 2 - element.offsetWidth / 2); var top = scrollTop + topOffset - 40; var left = scrollLeft + leftOffset - 70; element.style.position = "absolute"; element.style.top = top + "px"; element.style.left = left + "px"; } </script></telerik:RadCodeBlock>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CostBasisLotSelection.aspx.cs" Inherits="CostBasis.CostBasisLotSelection" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %><%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Cost Basis Lot Selection Screen</title> <link href="css/Default.css" rel="stylesheet" type="text/css" /> <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> <script type="text/javascript"> var sumInput = null; var tempValue = 100; function Load(sender, args) { sumInput = sender; sumInput.set_value(tempValue); } function Blur(sender, args) { alert(tempValue); sumInput.set_value(tempValue - sender.GetValue()); } function Focus(sender, args) { tempValue = sumInput.get_value() - sender.get_value(); } function letternumber(e) { var key; var keychar; if (window.event) key = window.event.keyCode; else if (e) key = e.which; else return true; keychar = String.fromCharCode(key); keychar = keychar.toLowerCase(); // control keys if ((key == null) || (key == 0) || (key == 8) || (key == 9) || (key == 13) || (key == 27)) return true; // alphas and numbers else if ((("abcdefghijklmnopqrstuvwxyz0123456789").indexOf(keychar) > -1)) return true; else return false; } function ClientValidate(source, arguments) { var DateTo = document.getElementById("dtToDate_dateInput_text").value; var DateFrom = document.getElementById("dtFromDate_dateInput_text").value; var dtto = new Date(DateTo); var dtFrom = new Date(DateFrom); if (DateFrom == undefined) { arguments.IsValid = true; } else { if (DateFrom > DateTo) { arguments.IsValid = false; } else { arguments.IsValid = true; } } } function OnKeyPress(sender, eventArgs) { var c = eventArgs.get_keyCode(); if ((c < 47) || (c > 57)) eventArgs.set_cancel(true); } function calculate(price, quantity) { var text1 = $find(price).get_value(); //I used Asp.net Ajax find method var text2 = quantity; //alert(text1 + " == "+text2) if (text1 >= text2) { //alert("here"); text1.focus(); } // var text3 = $find(totalAmount);// var total = text1.GetValue() * text2.GetValue();// text3.SetValue(total); } </script> </telerik:RadCodeBlock></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="Scriptmanager1" runat="server"> </asp:ScriptManager> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="btnGo"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="pnlTaxLotsSearch" LoadingPanelID="LoadingPanel1" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="btnTaxLotsGo"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="rgCostBasisTrades" /> <telerik:AjaxUpdatedControl ControlID="pnlTaxLotsSearch" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="rgCostBasisTrades"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="rgCostBasisTrades" LoadingPanelID="LoadingPanel3" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel ID="LoadingPanel1" runat="server" Style="padding-top: 45px;padding-left: 35px;" Height="75px" Width="75px" IsSticky="false" Transparency="30"> <img alt="Loading..." src="img/loadingReport.gif" style="border: 0;" /> </telerik:RadAjaxLoadingPanel> <telerik:RadAjaxLoadingPanel ID="LoadingPanel2" runat="server" Style="padding-top: 85px;padding-left: 15px;" Height="75px" Width="75px" IsSticky="false" Transparency="30"> <img alt="Loading..." src="img/loadingReport.gif" style="border: 0;" /> </telerik:RadAjaxLoadingPanel> </telerik:RadAjaxLoadingPanel> <telerik:RadAjaxLoadingPanel ID="LoadingPanel3" runat="server" Style="padding-top: 65px;padding-left: 20px;" IsSticky="false" Transparency="30"> <img alt="Loading..." src="img/loadingReport.gif" style="border: 0;" /> </telerik:RadAjaxLoadingPanel> <table border="0" cellpadding="4" cellspacing="0" width="100%"> <tr class="PageTitle" valign="middle"> <td> <span id="lblTitle" class="PageTitle">• Cost Basis Lot Selection Screen •</span> </td> </tr> <tr> <td> <table width="100%"> <tr> <td> <table width="100%"> <tr> <td style="width: 33%"> <asp:Panel runat="server" ID="pnlCustAcctNo" Visible="true" GroupingText="Customer Account Number" Height="55px" Width="100%" HorizontalAlign="Center"> <table> <tr valign="middle"> <td style="height: 35px;width:65%"> <asp:RequiredFieldValidator ID="rfdtxtCustAcctNo" Display="None" runat="server" ControlToValidate="txtCustAcctNo" ValidationGroup="gpUser" ErrorMessage=" Enter Account Number"></asp:RequiredFieldValidator> <telerik:RadTextBox ID="txtCustAcctNo" MaxLength="12" Skin="Office2007" CssClass="SMALLERTEXT" OnKeyPress="return letternumber(event);" runat="server"> </telerik:RadTextBox> <cc1:ValidatorCalloutExtender ID="valrqdFname_ValidatorCalloutExtender" runat="server" Width="15px" TargetControlID="rfdtxtCustAcctNo"> </cc1:ValidatorCalloutExtender> </td> <td> <asp:Button ID="btnGo" Enabled="true" OnClick="btnGo_Click" ValidationGroup="gpUser" runat="server" BorderStyle="None" CssClass="Buttons2" Text="Go" /> </td> </tr> </table> </asp:Panel> </td> <td style="width: 67%"> </td> </tr> </table> </td> </tr> <tr> <td> <table width="100%"> <tr> <td style="width: 83%"> <asp:Panel runat="server" ID="pnlTaxLotsSearch" Enabled="false" Visible="true" GroupingText="Tax Lots Search" Height="110px" HorizontalAlign="Center"> <table class="selectedPage" width="97%" style="height: 70px"> <tr> <td> <asp:CustomValidator ID="cstValFrmDate" runat="server" ControlToValidate="dtFromDate" ClientValidationFunction="ClientValidate" Display="None" ErrorMessage="From Date should be Less than To Date" ValidationGroup="GpTaxLot"> </asp:CustomValidator> </td> </tr> <tr align="left" > <td style="width: 24%"> <asp:Label ID="lblTaxLots" CssClass="SMALLERTEXTBOLD1" runat="server" Text="Tax Lots :"></asp:Label> </td> <td style="width: 26%"> <asp:RadioButtonList ID="rblSymbolCusip" Height="5px" CssClass="SMALLERTEXTBOLD1" runat="server" RepeatDirection="Horizontal"> <asp:ListItem Selected="True" Text="Symbol" Value="S"></asp:ListItem> <asp:ListItem Text="Cusip" Value="C"></asp:ListItem> </asp:RadioButtonList> </td> <td style="width: 24%"> <asp:Label ID="lblFromDate" CssClass="SMALLERTEXTBOLD1" runat="server" Text="From :"></asp:Label> </td> <td style="width: 24%"> <asp:Label ID="lblToDate" CssClass="SMALLERTEXTBOLD1" runat="server" Text="To :"></asp:Label> </td> <td style="width: 2%"> </td> </tr> <tr valign="top" align="left"> <td > <telerik:RadComboBox ID="cmdTaxLots" runat="server" Width="110px" MarkFirstMatch="True" Skin="Office2007" ToolTip="Select Tax Lots"> <Items> <telerik:RadComboBoxItem Text="All" /> <telerik:RadComboBoxItem Text="Open Lots" /> <telerik:RadComboBoxItem Text="Closed Lots" /> </Items> </telerik:RadComboBox> </td> <td style="width: 23%" > <telerik:RadTextBox ID="txtSymbolCusip" Width="110px" Skin="Office2007" CssClass="SMALLERTEXT" runat="server"> </telerik:RadTextBox> </td> <td> <telerik:RadDatePicker ID="dtFromDate" Width="110px" runat="server" ToolTip="Select Date" Skin="Office2007" Culture="English (United States)" > <dateinput labelcssclass="radLabelCss_Office2007" DateFormat="MM/dd/yyyy" skin="Office2007"> <ClientEvents OnKeyPress="OnKeyPress" /> </dateinput> <calendar showrowheaders="False" skin="Office2007" usecolumnheadersasselectors="False" userowheadersasselectors="False" viewselectortext="x"> <specialdays> <telerik:RadCalendarDay Date="" IsToday="True" Repeatable="Today"> <ItemStyle CssClass="rcToday" BorderColor="Red" BorderStyle="NotSet" /> </telerik:RadCalendarDay> </specialdays> </calendar> <datepopupbutton cssclass="radPopupImage_Office2007" /> </telerik:RadDatePicker> </td> <td> <telerik:RadDatePicker ID="dtToDate" Width="110px" ShowRowHeaders="false" runat="server" ToolTip="Select Date" Skin="Office2007" Culture="English (United States)"> <dateinput labelcssclass="radLabelCss_Office2007" DateFormat="MM/dd/yyyy" skin="Office2007"> <ClientEvents OnKeyPress="OnKeyPress" /> </dateinput> <calendar showrowheaders="False" skin="Office2007" usecolumnheadersasselectors="False" userowheadersasselectors="False" viewselectortext="x"> <specialdays> <telerik:RadCalendarDay Date="" IsToday="True" Repeatable="Today"> <ItemStyle CssClass="rcToday" BorderColor="Red" BorderStyle="Solid" /> </telerik:RadCalendarDay> </specialdays> </calendar> <datepopupbutton cssclass="radPopupImage_Office2007" /> </telerik:RadDatePicker> <cc1:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" Width="30 px" TargetControlID="cstValFrmDate"> </cc1:ValidatorCalloutExtender> </td> <td> <asp:Button ID="btnTaxLotsGo" runat="server" BorderStyle="None" CausesValidation="true" ValidationGroup="GpTaxLot" CssClass="Buttons2" OnClick="btnTaxLotGo_Click" Text="Go" /> </td> <td style="width: 100px"> </td> </tr> </table> </asp:Panel> </td> <td style="width: 17%"> </td> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td> <table width="90%" style="height:100%"> <tr> <td> <telerik:RadGrid ID="rgCostBasisTrades" runat="server" AllowMultiRowSelection="false" AllowPaging="false" ShowHeader="true" OnItemCommand="rgCostBasisTrades_ItemCommand" AllowSorting="false" OnNeedDataSource="rgCostBasisTrades_NeedDataSource" OnItemDataBound="rgCostBasisTrades_ItemDataBound" OnItemUpdated="rgCostBasisTrades_UpdateCommand" OnDetailTableDataBind="rgCostBasisTrades_DetailTableDataBind" AutoGenerateColumns="False" GridLines="None" Height="200px" LoadingTemplateTransparency="25" AlternatingItemStyle-BackColor="AliceBlue" Visible="true" Skin="Office2007" Width="100%" onupdatecommand="rgCostBasisTrades_UpdateCommand1"> <MasterTableView TableLayout="Fixed" Name="TaxlotsMain" > <PagerStyle Mode="NumericPages" Visible="False" /> <DetailTables> <telerik:GridTableView Name="Taxlots" ShowHeader="true" runat="server" Width="100 %" ShowFooter="true"> <Columns> <telerik:GridBoundColumn DataField="Symbol" HeaderButtonType="TextButton" HeaderText="Symbol" SortExpression="Symbol" UniqueName="Symbol"> <HeaderStyle HorizontalAlign="left" Width="20%" /> <ItemStyle HorizontalAlign="left" /> </telerik:GridBoundColumn> <telerik:GridTemplateColumn DataField="Shares" HeaderButtonType="TextButton" HeaderText="Shares" SortExpression="Shares" UniqueName="Shares"> <HeaderStyle HorizontalAlign="left" Width="20%" /> <ItemStyle HorizontalAlign="left" /> <ItemTemplate> <asp:Label ID="lblShares" runat="server" Text='<%# Eval("Shares") %>' /> </ItemTemplate> </telerik:GridTemplateColumn > <telerik:GridBoundColumn DataField="LotID" HeaderButtonType="TextButton" HeaderText="LotID" SortExpression="LotID" UniqueName="LotID"> <HeaderStyle HorizontalAlign="left" Width="20%" /> <ItemStyle HorizontalAlign="left" /> </telerik:GridBoundColumn> <telerik:GridTemplateColumn DataField="Allocation" HeaderButtonType="TextButton" HeaderText="Allocation" SortExpression="Allocation" UniqueName="Shares"> <ItemTemplate> <telerik:RadNumericTextBox ID="txtAllocation" Font-Size="xx-small" runat="server" Width="80%" MinValue="1" MaxValue="999999999" Text='<%#DataBinder.Eval(Container.DataItem, "Allocation")%>'> <ClientEvents OnBlur="Blur" /> <NumberFormat GroupSeparator="" DecimalDigits="0" /> </telerik:RadNumericTextBox> <asp:CompareValidator ID="CmptxtAllocation" runat="server" ErrorMessage="Enter Value Less Than Shares" ControlToValidate="txtAllocation" Display="None" Operator="LessThanEqual"></asp:CompareValidator> <cc1:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" Width="50 px" TargetControlID="CmptxtAllocation" > </cc1:ValidatorCalloutExtender> </ItemTemplate> <HeaderStyle HorizontalAlign="left" Width="20%" /> <ItemStyle HorizontalAlign="left" /> <FooterStyle HorizontalAlign="Left" Width="20%" /> <FooterTemplate> <telerik:RadNumericTextBox ID="txtTotalAllocation" Font-Size="xx-small" runat="server" MinValue="1" MaxValue="999999999" Width="80%"> <ClientEvents OnLoad="Load" /> <NumberFormat GroupSeparator="" DecimalDigits="0" /> </telerik:RadNumericTextBox> </FooterTemplate> </telerik:GridTemplateColumn> </Columns> </telerik:GridTableView> </DetailTables> <Columns> <telerik:GridBoundColumn DataField="Trade" HeaderButtonType="TextButton" HeaderText="Trade #" SortExpression="Trade" UniqueName="Trade"> <HeaderStyle HorizontalAlign="left" /> <ItemStyle HorizontalAlign="left" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="BS" HeaderButtonType="TextButton" HeaderText="B / S" SortExpression="BS" UniqueName="BS"> <HeaderStyle HorizontalAlign="left" /> <ItemStyle HorizontalAlign="left" /> </telerik:GridBoundColumn> <telerik:GridTemplateColumn DataField="Allocation" HeaderButtonType="TextButton" HeaderText="Allocation" SortExpression="Allocation" UniqueName="Shares"> </telerik:GridTemplateColumn> <telerik:GridBoundColumn DataField="Symbol" HeaderButtonType="TextButton" HeaderText="Description" SortExpression="Symbol" UniqueName="Symbol"> <HeaderStyle HorizontalAlign="left" /> <ItemStyle HorizontalAlign="left" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Price" HeaderButtonType="TextButton" HeaderText="Price" SortExpression="Price" UniqueName="Price"> <HeaderStyle HorizontalAlign="left" /> <ItemStyle HorizontalAlign="left" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Shares" HeaderButtonType="TextButton" HeaderText="Shares" SortExpression="Shares" UniqueName="Shares"> <HeaderStyle HorizontalAlign="left" /> <ItemStyle HorizontalAlign="left" /> </telerik:GridBoundColumn> <telerik:GridButtonColumn ButtonType="LinkButton" CommandName="Update" Text="Update" UniqueName="LotUpdate"> <HeaderStyle Width="60px" /> </telerik:GridButtonColumn> </Columns> </MasterTableView> <ClientSettings> <ClientEvents /> <Scrolling AllowScroll="True" UseStaticHeaders="True" /> <Selecting AllowRowSelect="True" /> </ClientSettings> <FilterMenu NotSelectedImageUrl="~/Skins/GridSkin/Ice/NotSelectedMenu.gif" SelectedImageUrl="~/Skins/GridSkin/Ice/SelectedMenu.gif"> </FilterMenu> </telerik:RadGrid> </td> </tr> </table> </td> </tr> <tr> <td align="center"> <%--<asp:Button ID="btnGridUpdate" runat="server" CssClass="Buttons" Text="Update" BorderStyle="None" Height="21px" Width="67px" /> <asp:HiddenField ID="hdnActionButtonClicked" Value="false" runat="server" />--%> </td> </tr> </table> </form></body></html>using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Data;using Telerik.Web.UI;using System.IO;using System.Configuration;namespace CostBasis{ public partial class CostBasisLotSelection : System.Web.UI.Page { //Button btnTaxLotGo; //Button btnCustAcctNoGo; protected void Page_Load(object sender, EventArgs e) { try { //UserControl ucCustAcctNo = (UserControl)FindControl("ucCustAcctDetails"); //ucCustAcctDetails. //CustAcctNo ucCostBasisDetail = (CustAcctNo)ucCustAcctNo; //ucCustAcctDetails.btnCustAcctNoHandler += new CustAcctNo.OnCustAcctNoButtonClick(ucCostBasisDetail_btnCustAcctNoHandler); // ucCustAcctDetails.btnCustAcctNoHandler += new CustAcctNo.OnCustAcctNoButtonClick(ucCustAcctDetails_btnCustAcctNoHandler); //TaxLotsSearch ucTaxLotSearch = (TaxLotsSearch)FindControl("ucTaxLotsSearch"); // ucTaxLotsSearch.btnHandler += new TaxLotsSearch.OnButtonClick(ucTaxLotSearch_btnHandler); // ucTaxLotsSearch.btnHandler += new TaxLotsSearch.OnButtonClick(ucTaxLotsSearch_btnHandler); //UserControl ucTaxLots = (UserControl)FindControl("ucTaxLotsSearch"); // btnTaxLotGo = (Button)ucTaxLotsSearch.FindControl("btnGo"); // btnCustAcctNoGo = (Button)ucCustAcctDetails.FindControl("btnGo"); // RadTextBox txtCustAcctNo = (RadTextBox)ucCustAcctDetails.FindControl("txtCustAcctNo"); if (!IsPostBack) { rgCostBasisTrades.Visible = false; //btnUpdate.Visible = false; btnTaxLotsGo.Enabled = false; } else { if (!txtCustAcctNo.Text.Equals(string.Empty)) { btnGo.Enabled = true; } } } catch (Exception ex) { } } protected void rgCostBasisTrades_ItemCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == RadGrid.ExpandCollapseCommandName) { GridDataItem dataItem = (GridDataItem)e.Item; LinkButton btnLotUpdate = (LinkButton)dataItem["LotUpdate"].Controls[0]; //insert custom logic here if (e.Item.Expanded) { btnLotUpdate.Enabled = false; } } } protected void btnGo_Click(object sender, EventArgs e) { btnTaxLotsGo.Enabled = true; pnlTaxLotsSearch.Enabled = true; } void ucTaxLotsSearch_btnHandler(string strValue) { } void ucCustAcctDetails_btnCustAcctNoHandler(string strValue) { } protected void btnTaxLotGo_Click(object sender, EventArgs e) { PopulateGrid(); } //void ucTaxLotSearch_btnHandler(string strValue) //{ //} //void ucCostBasisDetail_btnCustAcctNoHandler(string strValue) //{ //} protected void rgCostBasisTrades_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { if (Session["ReportDefinitionGridView1"] != null) { DataSet gridViewRptDef = this.Session["ReportDefinitionGridView1"] as DataSet; rgCostBasisTrades.DataSource = gridViewRptDef; rgCostBasisTrades.DataMember = "catalog"; } } void PopulateGrid() { rgCostBasisTrades.Visible = true; //btnUpdate.Visible = true; string myXMLfile = ConfigurationManager.AppSettings["CBLotSelection"]; DataSet ds = new DataSet(); try { ds.ReadXml(myXMLfile); this.Session["ReportDefinitionGridView1"] = ds; rgCostBasisTrades.Rebind(); } catch (Exception ex) { } } protected void rgCostBasisTrades_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item.OwnerTableView.Name == "TaxlotsMain") // check with name of DetailTable { if (e.Item is GridDataItem) { GridDataItem dataItem = (GridDataItem)e.Item; LinkButton btnLotUpdate = (LinkButton)dataItem["LotUpdate"].Controls[0]; if (e.Item.Expanded) { btnLotUpdate.Enabled = true; } else { btnLotUpdate.Enabled = false; } } } else if (e.Item.OwnerTableView.Name == "Taxlots") { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; RadNumericTextBox txtAllocation = item.FindControl("txtAllocation") as RadNumericTextBox; Label SharesLabel = item["Shares"].FindControl("lblShares") as Label; CompareValidator cmp = item.FindControl("CmptxtAllocation") as CompareValidator; //cmp.ValueToCompare = Math.Round(Convert.ToDecimal(SharesLabel.Text.ToString()), 2).ToString(); cmp.ValueToCompare = Convert.ToString(Convert.ToInt32(SharesLabel.Text.ToString())); //cmp.ValueToCompare = "100"; // cmp.c // Get the textbox for column Price //txtAllocation.Attributes.Add("onFocusout", "return calculate('" + txtAllocation.ClientID + "','" + 100 + "','" + txtTotalAmount.ClientID + "')"); // txtAllocation.Attributes.Add("onFocusout", "return calculate('" + txtAllocation.ClientID + "','" + 100 + "')"); // txtPrice.Attributes.Add("onFocusout", "return calculate('" + txtPrice.ClientID + "','" + txtQuantity.ClientID + "','" + txtTotalAmount.ClientID + "')"); // txtQuantity.Attributes.Add("onFocusout", "return calculate('" + txtPrice.ClientID + "','" + txtQuantity.ClientID + "','" + txtTotalAmount.ClientID + "')"); // txtTotalAmount.Attributes.Add("onfocus", "return calculate('" + txtPrice.ClientID + "','" + txtQuantity.ClientID + "','" + txtTotalAmount.ClientID + "')"); //} } //GridDataInsertItem insertItem = (GridDataInsertItem)e.Item; //GridDataItem parentitem = (GridDataItem)insertItem.OwnerTableView.ParentItem; //GridTableView tableView = (GridTableView)parentitem.ChildItem.NestedTableViews[0]; //tableView.GetColumn("EditcolumnUniqueName").Visible = true; //GridDataItem dataItem = (GridDataItem)ParentItem; //foreach (GridDataItem dataItem in rgCostBasisTrades.Items) // ((LinkButton)dataItem["EditcolumnUniqueName"].Controls[0]).Visible = false; } //else //{ // foreach (GridDataItem parentitem in rgCostBasisTrades.Items) // { // if (parentitem.Expanded) // { // LinkButton btnLotUpdate = (LinkButton)parentitem["LotUpdate"].Controls[0]; // btnLotUpdate.Enabled = false; // //GridTableView tableView = (GridTableView)parentitem.ChildItem.NestedTableViews[0]; // //tableView.GetColumn("EditcolumnUniqueName").Visible = false; // } // } //} //if (e.Item is GridDataItem) //{ // GridDataItem dataItem = (GridDataItem)e.Item; // LinkButton btnLotUpdate = (LinkButton)dataItem["LotUpdate"].Controls[0]; // btnLotUpdate.Enabled = false; //} } protected void rgCostBasisTrades_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e) { GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem; switch (e.DetailTableView.Name) { case "Taxlots": { LinkButton btnLotUpdate = (LinkButton)dataItem["LotUpdate"].Controls[0]; btnLotUpdate.Enabled = true; string myXMLfile = ConfigurationManager.AppSettings["CBLotSelection2"];//Path.Combine(Environment.CurrentDirectory, @"CostBasis\XML\SampleXML21.xml"); //"C:\\Documents and Settings\\SPuttappa\\My Documents\\Visual Studio 2008\\Projects\\CostBasis\\XML\\SampleXML21.xml"; DataSet ds = new DataSet(); try { ds.ReadXml(myXMLfile); e.DetailTableView.DataSource = ds; e.DetailTableView.DataMember = "catalog"; } catch (Exception ex) { } break; } } } protected void rgCostBasisTrades_UpdateCommand(object source, GridUpdatedEventArgs e) { } protected void rgCostBasisTrades_UpdateCommand1(object source, GridCommandEventArgs e) { //e.Item.OwnerTableView.ParentItem.OwnerTableView.Rebind(); } }}<fieldset id="fieldGrid" style="width: 870px"> <legend>Managers</legend> <telerik:RadGrid ID="RadGridManagers" runat="server" AutoGenerateColumns="False" AllowPaging="True" GridLines="None" Width="100%" Skin="Office2007" SkinID="RadGrid_UnPageable" PageSize="20" OnNeedDataSource="RadGridManagers_NeedDataSource" OnItemCreated="RadGridManagers_ItemCreated" OnInsertCommand="RadGridManagers_InsertCommand" OnUpdateCommand="RadGridManagers_UpdateCommand" DataSourceID="LinqDataSourceManagers"> <MasterTableView AutoGenerateColumns="False" CommandItemDisplay="Top" Width="100%" DataSourceID="LinqDataSourceManagers" DataKeyNames="OID" InsertItemPageIndexAction="ShowItemOnCurrentPage"> <Columns> <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="ColumnEditCommand" ItemStyle-CssClass="MyImageButton" /> <telerik:GridBoundColumn DataField="FirstName" HeaderText="First Name" UniqueName="ColumnFirstName" Visible="false" /> <telerik:GridBoundColumn DataField="LastName" HeaderText="Last Name" UniqueName="ColumnLastName" Visible="false" /> <telerik:GridTemplateColumn HeaderText="Name" UniqueName="columnName" ReadOnly="true"> <ItemTemplate> <%# string.Format("{0} {1}", Eval("FirstName"), Eval("LastName"))%> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridBoundColumn DataField="NickName" HeaderText="Nick Name" UniqueName="ColumnNickName" /> <telerik:GridDropDownColumn DataField="OID" HeaderText="Pharmacy" UniqueName="ColumnPharmacy" DataSourceID="LinqDataSourcePharmacies" ListValueField="OID" ListTextField="Name" ColumnEditorID="GridDropDownColumnEditorPharmacy" /> <telerik:GridBoundColumn DataField="PhoneNumber" HeaderText="Phone #" UniqueName="ColumnPhoneNumber" /> <telerik:GridBoundColumn DataField="MobileNumber" HeaderText="Mobile #" UniqueName="ColumnMobileNumber" /> <telerik:GridBoundColumn DataField="Email" HeaderText="Email Address" UniqueName="ColumnEmail" /> <%-- <telerik:GridButtonColumn ConfirmText="Delete this manager?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="ColumnDelete"> <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" /> </telerik:GridButtonColumn> --%> </Columns> <EditFormSettings CaptionDataField="FirstName" CaptionFormatString="Edit Manager {0}"> <EditColumn ButtonType="ImageButton" UniqueName="ColumnEditCommandE" /> <FormTableItemStyle Wrap="False" /> <FormCaptionStyle CssClass="EditFormHeader" /> <FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="3" BackColor="White" Width="100%" /> <FormTableStyle CellSpacing="0" CellPadding="2" Height="110px" BackColor="White" /> <FormTableAlternatingItemStyle Wrap="False" /> <FormTableButtonRowStyle /> </EditFormSettings> <CommandItemSettings ShowRefreshButton="true" ShowAddNewRecordButton="true" ShowExportToWordButton="false" ShowExportToExcelButton="true" ShowExportToPdfButton="true" ShowExportToCsvButton="true" /> <PagerStyle AlwaysVisible="true" Mode="NextPrevAndNumeric" Position="Bottom" /> </MasterTableView> <ClientSettings> <ClientEvents OnRowDblClick="RadGridManagers_OnRowDblClick" /> <Scrolling UseStaticHeaders="True" /> </ClientSettings> <ExportSettings HideStructureColumns="false" FileName="PharmacyManagers" IgnorePaging="True"> <Excel Format="ExcelML" /> <Csv ColumnDelimiter="VerticalBar" /> </ExportSettings> </telerik:RadGrid> <telerik:GridDropDownListColumnEditor ID="GridDropDownColumnEditorPharmacy" runat="server" DropDownStyle-Width="228px" /> <telerik:RadInputManager runat="server" ID="RadInputManagerManagers" Enabled="true"> <telerik:TextBoxSetting BehaviorID="TextBoxSettingNameFirst" EmptyMessage="Please enter a first name" /> <telerik:TextBoxSetting BehaviorID="TextBoxSettingNameLast" EmptyMessage="Please enter a last name" /> <telerik:TextBoxSetting BehaviorID="TextBoxSettingNameNick" EmptyMessage="Please enter a nick name" /> <telerik:RegExpTextBoxSetting BehaviorID="RegExpTextBoxSettingPhone" ErrorMessage="Invalid U.K. Phone Number" ValidationExpression="^(((\+44\s?\d{4}|\(?0\d{4}\)?)\s?\d{3}\s?\d{3})|((\+44\s?\d{3}|\(?0\d{3}\)?)\s?\d{3}\s?\d{4})|((\+44\s?\d{2}|\(?0\d{2}\)?)\s?\d{4}\s?\d{4}))(\s?\#(\d{4}|\d{3}))?$ " /> <telerik:RegExpTextBoxSetting BehaviorID="RegExpTextBoxSettingMobile" ErrorMessage="Invalid U.K. Mobile Number" ValidationExpression="^(\+44\s?7\d{3}|\(?07\d{3}\)?)\s?\d{3}\s?\d{3}$" /> <telerik:RegExpTextBoxSetting BehaviorID="RegExpTextBoxSettingEmail" ErrorMessage="Enter a valid email address" ValidationExpression="^(([\\w-]+\\.)+[\\w-]+|([a-zA-Z]{1}|[\\w-]{2,}))@((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|([a-zA-Z]+[\\w-]+\\.)+[a-zA-Z]{2,4})$" /> </telerik:RadInputManager></fieldset>private void ShowErrorMessage() { RadAjaxManager manager = RadAjaxManager.GetCurrent(this.Page); manager.ResponseScripts.Add("window.radalert(\"Please enter valid data!\")");}private void SetupInputManager(GridEditableItem editableItem) { InputSetting inputSetting; // style first name var textBox = ((GridTextBoxColumnEditor)editableItem.EditManager.GetColumnEditor("ColumnFirstName")).TextBoxControl; textBox.ID = "TextBoxFirstName"; inputSetting = RadInputManagerManagers.GetSettingByBehaviorID("TextBoxSettingNameFirst"); inputSetting.InitializeOnClient = true; inputSetting.TargetControls.Add(new TargetInput(textBox.UniqueID, true)); inputSetting.Validation.IsRequired = true; // style last name textBox = ((GridTextBoxColumnEditor)editableItem.EditManager.GetColumnEditor("ColumnLastName")).TextBoxControl; textBox.ID = "TextBoxLastName"; inputSetting = RadInputManagerManagers.GetSettingByBehaviorID("TextBoxSettingNameLast"); inputSetting.InitializeOnClient = true; inputSetting.TargetControls.Add(new TargetInput(textBox.UniqueID, true)); inputSetting.Validation.IsRequired = true; // style nick name textBox = ((GridTextBoxColumnEditor)editableItem.EditManager.GetColumnEditor("ColumnNickName")).TextBoxControl; textBox.ID = "TextBoxNickName"; inputSetting = RadInputManagerManagers.GetSettingByBehaviorID("TextBoxSettingNameNick"); inputSetting.InitializeOnClient = true; inputSetting.TargetControls.Add(new TargetInput(textBox.UniqueID, true)); // style phone number textBox = ((GridTextBoxColumnEditor)editableItem.EditManager.GetColumnEditor("ColumnPhoneNumber")).TextBoxControl; textBox.ID = "TextBoxPhoneNumber"; inputSetting = RadInputManagerManagers.GetSettingByBehaviorID("RegExpTextBoxSettingPhone"); inputSetting.InitializeOnClient = true; inputSetting.TargetControls.Add(new TargetInput(textBox.UniqueID, true)); // style mobile number textBox = ((GridTextBoxColumnEditor)editableItem.EditManager.GetColumnEditor("ColumnMobileNumber")).TextBoxControl; textBox.ID = "TextBoxMobileNumber"; inputSetting = RadInputManagerManagers.GetSettingByBehaviorID("RegExpTextBoxSettingMobile"); inputSetting.InitializeOnClient = true; inputSetting.TargetControls.Add(new TargetInput(textBox.UniqueID, true)); // style email textBox = ((GridTextBoxColumnEditor)editableItem.EditManager.GetColumnEditor("ColumnMobileNumber")).TextBoxControl; textBox.ID = "TextBoxEmail"; inputSetting = RadInputManagerManagers.GetSettingByBehaviorID("RegExpTextBoxSettingEmail"); inputSetting.InitializeOnClient = true; inputSetting.TargetControls.Add(new TargetInput(textBox.UniqueID, true));}#region Grid Relatedprotected void RadGridManagers_NeedDataSource(object source, GridNeedDataSourceEventArgs e) { RadGridManagers.DataSource = LinqDataSourceManagers;}protected void RadGridManagers_ItemCreated(object sender, GridItemEventArgs e) { if (e.Item is GridEditableItem && (e.Item.IsInEditMode)) { GridEditableItem editableItem = (GridEditableItem)e.Item; SetupInputManager(editableItem); }}protected void RadGridManagers_UpdateCommand(object source, GridCommandEventArgs e) { var editableItem = ((GridEditableItem)e.Item); var editManagerID = (long)editableItem.GetDataKeyValue("OID"); //retrieve entity form the Db var editManager = DbContext.Managers.Where(maan => maan.OID == editManagerID).FirstOrDefault(); if (editManager != null) { try { //update entity's state editableItem.UpdateValues(editManager); //submit changes to Db DbContext.SubmitChanges(); } catch (Exception) { ShowErrorMessage(); } }}protected void RadGridManagers_InsertCommand(object source, GridCommandEventArgs e) { var editableItem = ((GridEditableItem)e.Item); //extract properties Hashtable values = new Hashtable( ); editableItem.ExtractValues(values); //create new entity Manager newManager = new Manager() { FirstName = (string)values["FirstName"] ?? String.Empty, LastName = (string)values["LastName"] ?? String.Empty, NickName = (string)values["NickName"] ?? String.Empty, PhoneNumber = (string)values["PhoneNumber"] ?? String.Empty, MobileNumber = (string)values["MobileNumber"] ?? String.Empty, Email = (string)values["Email"] ?? String.Empty }; DbContext.Managers.InsertOnSubmit(newManager); try { //submit changes to Db DbContext.SubmitChanges(); } catch (Exception) { ShowErrorMessage(); }}#endregion