or

<%@ Register Src="~/secured/IntakeRequest/ascx/DocumentRepository.ascx" TagName="DocumentRepository" TagPrefix="ADAAC" %><telerik:RadScriptManager runat="server" ID="RadScriptManager1" /><telerik:RadFormDecorator ID="radFormDecorator" runat="server" DecoratedControls="All" Skin="Office2010Silver" EnableRoundedCorners="false" /> <telerik:RadAjaxManager runat="server" ID="radAjaxManager1" OnAjaxRequest="radAjaxManager1_AjaxRequest"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="radAjaxManager1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="adaacDocumentRepository" UpdatePanelRenderMode="Inline" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings></telerik:RadAjaxManager><telerik:RadScriptBlock runat="server"> <script type="text/javascript"> function windowCommunicationLog_OnClientBeforeShow(sender, args) { var ajaxManager = $find("<%= radAjaxManager1.ClientID %>"); ajaxManager.ajaxRequest("windowCommunicationLog_OnClientBeforeShow"); } </script></telerik:RadScriptBlock><telerik:RadWindow runat="server" ID="windowDocumentRepository" Title="Document Repository" Width="1024" Height="700" VisibleOnPageLoad="false" Behaviors="Close, Move" EnableShadow="true" Modal="true" DestroyOnClose="false" OnClientBeforeShow="windowDocumentRepository_OnClientBeforeShow"> <ContentTemplate> <ADAAC:DocumentRepository runat="server" ID="adaacDocumentRepository" /> </ContentTemplate></telerik:RadWindow>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
windowDocumentRepository.OpenerElementID = btnImportDocument.ClientID;
}
protected
void radAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{ if (e.Argument == "windowDocumentRepository_OnClientBeforeShow") { // the only thing this does is bind a repeater with a list of documents already uploaded adaacDocumentRepository.BindDocuments(); }}<telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel2" Skin="Metro" BackgroundPosition="Center" Direction="LeftToRight" EnableSkinTransparency="false"></telerik:RadAjaxLoadingPanel><telerik:RadAjaxManagerProxy runat="server" ID="radAjaxManagerProxy1"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="btnUploadFile"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="btnUploadFile" LoadingPanelID="RadAjaxLoadingPanel2" UpdatePanelRenderMode="Inline" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings></telerik:RadAjaxManagerProxy><telerik:RadWindow runat="server" ID="windowAddDocument" Title="Import a Document" Width="800" Height="250" VisibleOnPageLoad="false" Behaviors="Close, Move" EnableShadow="true" Modal="true" IconUrl="/images/windowIcon.png"> <ContentTemplate> <div><b>Select a document to upload</b></div> <div> File: </div> <div> <telerik:RadAsyncUpload runat="server" MaxFileInputsCount="1" ID="fileUpload1" ControlObjectsVisibility="None" Width="375" /> </div> <div> <asp:Button runat="server" ID="btnUploadFile" OnClick="btnUploadFile_OnClick" Text="Upload File" /> </div> <div> Browse for a file and then hit the "Upload" button. </div> </ContentTemplate></telerik:RadWindow><div> <asp:ImageButton ImageUrl="adddoc.jpg" AlternateText="Add a Document" runat="server" ID="btnUploadDoc" /></div>protected void Page_Load(object sender, EventArgs e){ RadAjaxManager manager = RadAjaxManager.GetCurrent(Page); manager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(radAjaxManager1_AjaxRequest); if (!IsPostBack) { windowAddDocument.OpenerElementID = btnUploadDoc.ClientID; }}protected void btnUploadFile_OnClick(object o, EventArgs e){ if (fileUpload1.UploadedFiles.Count == 1) { string encFileName = Guid.NewGuid() + GetFileExtension(fileUpload1.UploadedFiles[0].FileName); string uploadPath = Server.MapPath("/documents/" + encFileName); fileUpload1.UploadedFiles[0].SaveAs(uploadPath); BindDocuments(); // this just rebinds the uploaded documents }}protected void radAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e){ // this is just here so I can use radconfirm to do file deletions from the grid}{ 'isEnabled':'true', 'uploadedFiles':[ { "fileInfo":{ "FileName":"Footer Graphic.png", "ContentType":"image/png", "ContentLength":18389, "Index":0 }, "metaData":"/wEFwwF7IlRlbXBGaWxlTmFtZSI6IjEzNTU4NzU4MzI1NjFGb290ZXIgR3JhcGhpYy5wbmciLCJBc3luY1VwbG9hZFR5cGVOYW1lIjoiVGVsZXJpay5XZWIuVUkuVXBsb2FkZWRGaWxlSW5mbywgVGVsZXJpay5XZWIuVUksIFZlcnNpb249MjAxMi4yLjkxMi4zNSwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj0xMjFmYWU3ODE2NWJhM2Q0In0NCNiTh2r8IZeBu1RIF0/Xu3qk/w==" } ]},
<asp:MultiView ID="CustomMultiView" runat="server"> <asp:View ID="MyView1" runat="server"> <div> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="radgrid1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="radgrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> <telerik:AjaxUpdatedControl ControlID="hdnRowsCount" LoadingPanelID="RadAjaxLoadingPanel1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" > </telerik:RadAjaxLoadingPanel> <asp:HiddenField ID="hdnRowsCount" runat="server" Value="0" /> <telerik:RadGrid ID="radgrid1" runat="server" ShowStatusBar="True" ShowFooter="True" OnItemCommand="radgrid1_ItemCommand" OnDeleteCommand="radgrid1_DeleteCommand" OnInsertCommand="radgrid1_InsertCommand" OnUpdateCommand="radgrid1_UpdateCommand" OnNeedDataSource="radgrid1_NeedDataSource" OnItemDataBound="radgrid1_ItemDataBound"> <MasterTableView DataKeyNames="ProductNumber" AutoGenerateColumns="false" EditMode="InPlace" CommandItemDisplay="TopAndBottom" CommandItemSettings-AddNewRecordText="Add New Purchase Order"> <Columns> <telerik:GridEditCommandColumn ButtonType="ImageButton"> </telerik:GridEditCommandColumn> <telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" ConfirmDialogHeight="100px" ConfirmDialogWidth="220px"> </telerik:GridButtonColumn> <telerik:GridTemplateColumn DataField="ProductNumber" HeaderText="Product Number" UniqueName="ProductNumber" Visible="true"> <InsertItemTemplate> <telerik:RadTextBox ID="RadtxtPrdNumber" runat="server" Text=""> </telerik:RadTextBox> </InsertItemTemplate> <EditItemTemplate> <telerik:RadTextBox ID="RadtxtPrdNumber" runat="server" Text='<%# Eval("ProductNumber") %>'> </telerik:RadTextBox> </EditItemTemplate> <ItemTemplate> <telerik:RadTextBox ID="RadtxtPrdNumber" ReadOnly="true" runat="server" Text='<%# Eval("ProductNumber") %>' /> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView> <ClientSettings EnableRowHoverStyle="true"> </ClientSettings> </telerik:RadGrid> </div> </asp:View> <asp:View ID="ThanksView" runat="server"> <table width="100%" > <tr> <td colspan="2" align="center" > <asp:Label ID="lblThankYou" Text="Thank You" runat="server"></asp:Label> </td> </tr> <tr> <td /> <td align="center"> <asp:Button ID="btnThanks" runat="server" Text="Ok" OnClick="btnThanks_Click" Width="90px" /> </td> </tr> </table> </asp:View> </asp:MultiView> if (!string.IsNullOrEmpty(strThankURL)) CustomMultiView.ActiveViewIndex = 0; Response.Redirect(strThankURL);
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" > <AjaxSettings> <telerik:AjaxSetting AjaxControlID="radgrid1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="radgrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> <telerik:AjaxUpdatedControl ControlID="hdnRowsCount" LoadingPanelID="RadAjaxLoadingPanel1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" Width="75px" Transparency="25"> <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' style="border: 0;" /></telerik:RadAjaxLoadingPanel> <asp:HiddenField ID="hdnRowsCount" runat="server" Value="0" /> <telerik:RadGrid ID="radgrid1" runat="server" ShowStatusBar="True" ShowFooter="True" OnItemCommand="radgrid1_ItemCommand" OnDeleteCommand="radgrid1_DeleteCommand" OnInsertCommand="radgrid1_InsertCommand" OnUpdateCommand="radgrid1_UpdateCommand" OnNeedDataSource="radgrid1_NeedDataSource" onitemdatabound="radgrid1_ItemDataBound" CellSpacing="0" GridLines="None" > <MasterTableView DataKeyNames="ProductNumber" AutoGenerateColumns="false" EditMode="InPlace" CommandItemDisplay="TopAndBottom" CommandItemSettings-AddNewRecordText="Add New Purchase Order"> <Columns> </columns><asp:Panel ID="PnlRequest" runat="server">
For testing purposes i am using one table only.
The table Design is
ProductID autonumber
ID int
ProductName Varchar(100)
Price Varchar(150)
Then i also added DataType=DataType=System.Decimal then i get an error
This is my ASPX code<asp:Content ID="Content2" ContentPlaceHolderID="contentplaceholder1" runat="server"> <telerik:RadScriptManager runat="server" ID="RadScriptManager1" /> <telerik:RadSkinManager ID="QsfSkinManager" runat="server" ShowChooser="true" /> <telerik:RadFormDecorator ID="QsfFromDecorator" runat="server" DecoratedControls="All" EnableRoundedCorners="false" /> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadGrid1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadGrid1"></telerik:AjaxUpdatedControl> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadGrid ID="RadGrid1" Width="100%" AllowSorting="True" ShowFooter="True" PageSize="15" AllowPaging="True" AllowMultiRowSelection="True" ShowChooser="true" runat="server" GridLines="None" AutoGenerateColumns="False" CellSpacing="0" DataSourceID="ObjectDataSource1"> <MasterTableView Width="100%" Summary="RadGrid table" RetrieveAllDataFields="false" DataSourceID="ObjectDataSource1"> <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings> <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"> </RowIndicatorColumn> <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"> </ExpandCollapseColumn> <Columns> <telerik:GridBoundColumn DataField="Productid" HeaderText="Productid" DataType="System.Int32" SortExpression="Productid"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="id" HeaderText="id" DataType="System.Int32" FilterControlAltText="Filter id column" SortExpression="id" UniqueName="id"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ProductName" HeaderText="ProductName" FilterControlAltText="Filter ProductName column" SortExpression="ProductName" UniqueName="ProductName"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Price" HeaderText="Price" SortExpression="Price" Aggregate="Sum" FooterText="Total price: "> </telerik:GridBoundColumn> </Columns> <EditFormSettings> <EditColumn FilterControlAltText="Filter EditCommandColumn column"> </EditColumn> </EditFormSettings> </MasterTableView> <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle> <FilterMenu EnableImageSprites="False"> </FilterMenu> </telerik:RadGrid> <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetListProduct" TypeName="Business.ProductManager"></asp:ObjectDataSource></asp:Content>///////////////////////////////////////////////////////////////////////// public static ProductList GetListProduct() { ProductList tempList = null; string sql = "SELECT * from Product"; //using (SqlConnection myConnection = new SqlConnection(AppConfig.ConnectionString)) using (SqlConnection myConnection = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["NLayer"].ConnectionString)) { using (SqlCommand myCommand = new SqlCommand(sql, myConnection)) { myConnection.Open(); using (SqlDataReader myReader = myCommand.ExecuteReader()) { if (myReader.HasRows) { tempList = new ProductList(); while (myReader.Read()) { tempList.Add(FillDataRecordProduct(myReader)); } } myReader.Close(); } } return tempList; } } private static Product FillDataRecordProduct(IDataRecord myDataRecord) { Product myUserTracking = new Product(); myUserTracking.Productid = myDataRecord.GetInt32(myDataRecord.GetOrdinal("Productid")); myUserTracking.id = myDataRecord.GetInt32(myDataRecord.GetOrdinal("id")); myUserTracking.ProductName = myDataRecord.GetString(myDataRecord.GetOrdinal("ProductName")); myUserTracking.Price = myDataRecord.GetString(myDataRecord.GetOrdinal("Price")); return myUserTracking; }