Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
45 views
I have a RADGrid (inherited) that I am manipulating using Server-Side code. When I first initialize the grid, I add a NestedViewTemplate that I designed to the grid. When the page loads, the grid appears perfectly fine. Inside the grid rows, I have an ImageButton that when pressed, updates the DataBoundItem, and then refreshs the grid with the new information. When the grid refreshes, the NestedViewTemplate vanishes.

I've tried RADGrid.DataBind() as well as RADGrid.Rebind().  In both cases I check if RADGrid.MasterTableView.NestedViewTemplate is empty...if it is, I re-add the NestedViewTemplate before the "DataBind". I see that the ItemCreated() method runs, and it does create a "GridNestedViewItem"...but when the process is complete, the NestedView doesn't appear. I have to completely re-load the page to get the NestedView to re-appear.

Any ideas?
Angel Petrov
Telerik team
 answered on 21 Dec 2012
5 answers
1.6K+ views
I have been unable to find a satisfactory solution to using the RadEditor in preview mode without a toolbar. While I use the control on some pages for entering content, I have pages that also provide a read-only details view. I simply wish to provide the content for review, allow the user to scroll through the contents, but not show any toolbar. I have come close but a blank toolbar is always shown when the page renders.

Searching the forums and submitting support tickets has resulted in a few suggested solutions: including some style tags or using a ToolsFile.xml that has only <root></root> in it. Unfortunately these have not made any difference, I still get the exact same result. One suggestion is to disable the control which will cause RadEditor to display like a textbox. While this does work, it also eliminates the ability to scroll through the content.

My basic implementation consists of a ListView server control showing various data bound columns including the following:

                            <telerik:radeditor id="redBody" runat="server" Skin="Office2007" 
                                editmodes="Preview"  height="300px" ToolbarMode="ShowOnFocus"  
                                Content='<%# Eval("Body") %>'
                                width="100%">
                                <Tools><telerik:EditorToolGroup></telerik:EditorToolGroup></Tools>
                                <Modules>
                                    <telerik:EditorModule />
                                </Modules>                           
                            </telerik:radeditor>  

Again, I have tried adding a ToolsFile.xml with only <root></root>
I have tried several style suggestions found throughout the forums threads relating to hiding the toolbar. While no icons are shown in the toolbar, the empty toolbar is still visible.

It would make a lot of sense to me if there was a "None" or "Hidden" option available for the "ToolbarMode" attribute. If nothing else, I may have to create a custom Skin and try to fully hide the toolbar in that manner but I have not had time to try that yet.

Has anyone else ran into this or have any suggestions?

Thank you,
Jerry
Rumen
Telerik team
 answered on 21 Dec 2012
1 answer
222 views
I am receiving an error message when trying to upload files via the RadAsyncUpload. It is strange because it doesn't seem to happen all the time, and I haven't been able to pinpoint exactly when it happens.  

The way that I have this setup is that I have a user control called DocumentRepository.  The control is in a RadWindow which is opened by clicking on a LinkButton in the aspx page.  Inside that control, I can click on a button which opens another RadWindow allowing the user to browse for and upload a file.  That uses RadAjaxUpload.

So to start, I have my aspx page:
<%@ 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>

aspx.cs:

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();
    }
}

Inside the user control adaacDocumentRepository:
<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>

ascx.cs file:

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
}


The json request that is being generated that is causing the error is:

{
  'isEnabled':'true',
  'uploadedFiles':[
    {
      "fileInfo":{
        "FileName":"Footer Graphic.png",
        "ContentType":"image/png",
        "ContentLength":18389,
        "Index":0
      },
 "metaData":"/wEFwwF7IlRlbXBGaWxlTmFtZSI6IjEzNTU4NzU4MzI1NjFGb290ZXIgR3JhcGhpYy5wbmciLCJBc3luY1VwbG9hZFR5cGVOYW1lIjoiVGVsZXJpay5XZWIuVUkuVXBsb2FkZWRGaWxlSW5mbywgVGVsZXJpay5XZWIuVUksIFZlcnNpb249MjAxMi4yLjkxMi4zNSwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj0xMjFmYWU3ODE2NWJhM2Q0In0NCNiTh2r8IZeBu1RIF0/Xu3qk/w=="
    }
  ]
},


When I run it through a validator, it appears as though it is the first part that is causing the error, since isEnabled and uploadedFiles is in single quotes instead of double quotes, and the 'true' needs to be either a Boolean, or a string in double quotes....

Any ideas as to how I can fix this?  I can't seem to find anybody else that is having this problem.....

I have not been able to recreate this, but it is definitely happening as I can see the error messages coming in pretty regularly.  Why are those values coming in with single quotes?  What is causing it?  Do I need to hack it somehow or is there a fix?

It is definitely the posted value from the RadAsyncUpload control:

ctl00_ctl00_PageContent_PageContent2_windowDocumentRepository_C_adaacDocumentRepository_windowAddDocument_C_fileUpload1_ClientState:{'isEnabled':'true','uploadedFiles':[{"fileInfo":{"FileName":"Footer Graphic.png","ContentType":"image/png","ContentLength":18389,"Index":0},"metaData":"/wEFwwF7IlRlbXBGaWxlTmFtZSI6IjEzNTU4NzU4MzI1NjFGb290ZXIgR3JhcGhpYy5wbmciLCJBc3luY1VwbG9hZFR5cGVOYW1lIjoiVGVsZXJpay5XZWIuVUkuVXBsb2FkZWRGaWxlSW5mbywgVGVsZXJpay5XZWIuVUksIFZlcnNpb249MjAxMi4yLjkxMi4zNSwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj0xMjFmYWU3ODE2NWJhM2Q0In0NCNiTh2r8IZeBu1RIF0/Xu3qk/w=="}]},
 
Thanks in advance!!!
Plamen
Telerik team
 answered on 21 Dec 2012
3 answers
92 views
HI,
I am using RADAjax and RADGrid in my visual web part (sharepoint 2010). I am getting few javascript errors on various conditions.

1) In the radgrid, when i add records, i am getting the below error:

Message: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near '  Thank you for usin'.
Line: 4723
Char: 21
Code: 0
URI: http://servername/ScriptResource.axd?d=eL94jLYXyC1Ne7nMOhg5PV9Bc_C9wqj9jKtIId87UYURvmLRPgEsYaOYUpYwJp7GaVHtrRGRkeOKW3WYMMbRy-duh7cUEOREbfyYjiqjOGZ4qN1ieIbd3n1xpdnZQJGzfx3K6HUX6wvflpD-CcngpY9TgIxJDabpEaG8OReERINlgRhX0&t=ffffffffb868b5f4

2) I have a button outside the ajax, and clicking on the button, i am redirecting the page. I am getting the below javascript error:


Message: Sys.ArgumentNullException: Value cannot be null.
Parameter name: panelsCreated[3]
Line: 129
Char: 12
Code: 0
URI: http://servername/ScriptResource.axd?d=RPebyLkP-fhDCOP8R5TjxWPY-4fkPjRpQKETtPt1vJ0oYKjzG0P1oXDrWwqGUYowJk6FNzcl9JDcrVPqxhlevrLUyg2lficlL2Y9_KKnDvF49irZMVbCoI5gJzWm8v_Unf6FfAqjKOclBxnSZZAf9ybMAzMisFKw_edGwuOokTcB0Hr10&t=ffffffffb868b5f4

I have used the UI as below:
<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>

In the btnThanks click, i have the code below:

if (!string.IsNullOrEmpty(strThankURL))
CustomMultiView.ActiveViewIndex = 0;
 Response.Redirect(strThankURL);

How to fix the javascript errors?

Thanks
Maria Ilieva
Telerik team
 answered on 21 Dec 2012
1 answer
99 views

Hi everybody,
I have issue with Enter key pressed on radnumerictextbox. This key is not handled by OnKepPress event  in clientevents with IE9 and Chrome 23 (only work fine in firefox)
Is there any workaround to have Enter key handled by RadNumericTextBox in IE and Chrome?
I use Telerik version 2012.1.411.35

--------Control-------

<telerik:RadNumericTextBox ID="zoomNumber" runat="server" Height="25" Type="Number"
                                                AutoPostBack="False" ShowSpinButtons="True" Width="55px" MaxValue="400" MinValue="25"
                                                Value="100" Enabled="True" ReadOnly="False">
                                                <NumberFormat DecimalDigits="0"></NumberFormat>
                                                <IncrementSettings Step="8" InterceptMouseWheel="False"></IncrementSettings>
                                                <EnabledStyle ForeColor="#FFFFFF" BackColor="#215C7A" BorderColor="#333333" HorizontalAlign="Right" />
                                                <ClientEvents OnValueChanged="zoomChanged" OnValueChanging="zoomChanging" OnKeyPress="onNumericKeyPress"></ClientEvents>
                                            </telerik:RadNumericTextBox>

---------Javascript-------------

  function onNumericKeyPress(sender, args) {
        if (sender != null) {
            if (args.get_keyCode() == 13) {
                sender.set_value(parseFloat(sender.get_editValue()));
            }
            var c = args.get_keyCode();
            if ((c < 48) || (c > 57))
                args.set_cancel(true);
        }
    }


Best regards,
Ba

Eyup
Telerik team
 answered on 21 Dec 2012
3 answers
281 views
Hi,
I am using Rad grid . The UI is as below:
<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>

I am getting the error  "Microsoft JScript runtime error: Sys.ArgumentNullException: Value cannot be null. Parameter name: panelsCreated[3]". The grid and the ajax is inside a panel , which is defined as below:

<asp:Panel ID="PnlRequest" runat="server">

How to fix this?
Thanks
Maria Ilieva
Telerik team
 answered on 21 Dec 2012
1 answer
159 views
I am using the RadSessionPageStatePersister approach for storing t he viewstate in session and I am getting the following error. Please help me out.

[InvalidCastException: Specified cast is not valid.]

at System.Web.UI.SessionPageStatePersister.Load()

[HttpException: The state information is invalid for this page and might be corrupted.]
at System.Web.UI.SessionPageStatePersister.Load()
at Telerik.Web.UI.RadSessionPageStatePersister.Load()
at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
at System.Web.UI.Page.LoadAllState()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,\ Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint,\ Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.default_aspx.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Martin
Telerik team
 answered on 21 Dec 2012
1 answer
80 views
Hi,

Sub:  RadEditor: Problem with InsertLinks 

When I  select image or Links in editor and click on Insert Links extra space is adding below the selected image/Links.

Can Anyone help?

Thanks in Advance
Marin Bratanov
Telerik team
 answered on 21 Dec 2012
7 answers
367 views
Hi,

my approach is to backup files when a user loads up a file which already exists in the filesystem.
I took a look at the online documentation as well as in the DBContentProvider - but without meaningful documentation it would really mean a lot of time to figure out what parameters to pass where.

And if I see constructors with 7 parameters like for DirectoryItem it is pretty hard to develop something without documentation.
And by the way - the example (DBContentProvider) deals with slashes - as well for url's (normal) as for filepaths (where I would use backslashes for the file system).
A lot of parameter are simply give as string.Empty...

So the idea of writing an own provider is good - and since the FileExplorer does not offer server methods like the RadUpload to handle uploading (storing) files it seems to be the only possible method.
BUT - due to the poor documentation it is impossible for me to build such a thing within a timeframe that seems to be acceptable.

Is there any sample for a filesystem provider?

The approach is nothing less or more than:
If a file gets deleted - create a backup copy.
If a file will be overwritten - create a backup copy.

In http://www.telerik.com/community/forums/aspnet-ajax/file-explorer/select-a-file-in-code.aspx#792727 someone asked a member to provide code in the Code Library - but the Library does not even have a section for FileExplorer.

Regards

Manfred
Fiko
Telerik team
 answered on 21 Dec 2012
1 answer
703 views
I am getting this error

Sum is not supported for type "System.Object"

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

A value of type 'String' cannot be converted to type 'Decimal?'


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;
        }

         



Eyup
Telerik team
 answered on 21 Dec 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?