This is a migrated thread and some comments may be shown as answers.

Databindig

5 Answers 34 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Fabio Cirillo
Top achievements
Rank 1
Fabio Cirillo asked on 02 Jul 2013, 09:06 AM
Hello,
I need to have information on loading speed records in a grid.
 it is better to load the data with a webserviceor use a simple databinding or for example a databinding to datareader or arrylist?

5 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 02 Jul 2013, 09:41 AM
Hello,

If you use Service binding then viewstate data not created so it is giving the better performance.

There is not any relation of datareader or arrylist to Radgrid performance.

Thanks,
Jayesh Goyani
0
Fabio Cirillo
Top achievements
Rank 1
answered on 02 Jul 2013, 11:23 AM
hello,
so I advice you to use the webservice to load the data in the grid?, only I use the webmethod to load the data and often do not know how to load data into the grid. Can you give me some help with an example?
0
Jayesh Goyani
Top achievements
Rank 2
answered on 02 Jul 2013, 11:37 AM
Hello,

If you want pass some parameter in your service call then
RadGrid with WCF Rest Service

else

Grid - Declarative Binding :- (If possible then please use this way with webMethod)
Grid - Programmatic Binding

Thanks,
Jayesh Goyani
0
Fabio Cirillo
Top achievements
Rank 1
answered on 15 Jul 2013, 11:03 AM
it is better to load the data with a webservice, but i've this webmethod:

<WebMethod()> _
Private Function GetSchedineDate(ByVal Itemschedina As schedina.proprieta, ByVal idstruttura As Integer, ByVal data As Date) As schedina.schedineCollection
    Dim ListSchedine As New schedina.schedineCollection
    Using scope As New TransactionScope()
        Try
            Dim conString = ConfigurationManager.ConnectionStrings("Receptionstring")
            Dim strConnString As String = conString.ConnectionString
            Using db As New SqlConnection(strConnString)
                db.Open()
                Using sqlcmd As New SqlCommand("get_movimenti_singologiorno", db)
                    sqlcmd.CommandType = CommandType.StoredProcedure
                    sqlcmd.Parameters.AddWithValue("@idstruttura", SqlDbType.Int).Value = idstruttura
                    sqlcmd.Parameters.AddWithValue("@data", SqlDbType.SmallDateTime).Value = data
                    Using sqldr As SqlDataReader = sqlcmd.ExecuteReader
                        Itemschedina = New schedina.proprieta
                        Itemschedina.cognome = sqldr.GetSqlString(2).Value
                        Itemschedina.nome = sqldr.GetSqlString(3).Value
                        Itemschedina.sesso = sqldr.GetSqlInt32(4).Value
                        Itemschedina.cittandinanza = sqldr.GetSqlString(6).Value
                        Itemschedina.luogonascita = sqldr.GetSqlString(8).Value
                        Itemschedina.datanascita = sqldr.GetSqlDateTime(9).Value
                        Itemschedina.luogoresidenza = sqldr.GetSqlString(11).Value
                        Itemschedina.documento = sqldr.GetSqlString(13).Value
                        Itemschedina.ndocumento = sqldr.GetSqlString(14).Value
                        Itemschedina.luogodocumento = sqldr.GetSqlString(16).Value
                        Itemschedina.idrecord = sqldr.GetSqlInt32(17).Value
                        ListSchedine.Add(Itemschedina)
                    End Using
                End Using
            End Using
        Catch ex As SqlException
            Throw ex
            Exit Function
        Catch ex As Exception
            Throw ex
            Exit Function
        End Try
        scope.Complete()
    End Using
    Return ListSchedine
End Function

how can I add it to a grid?

this is my code aspx (grid)

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" AutoGenerateHierarchy="True" CellSpacing="0" Culture="it-IT" Height="450px" GridLines="None" PageSize="30" Skin="WebBlue">
                    <ClientSettings>
                        <Selecting AllowRowSelect="True" />
                        <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                    </ClientSettings>
                    <MasterTableView>
                        <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                        <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                            <HeaderStyle Width="20px"></HeaderStyle>
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                            <HeaderStyle Width="20px"></HeaderStyle>
                        </ExpandCollapseColumn>
                        <Columns>
                            <telerik:GridImageColumn FilterControlAltText="Filter icona column" ImageHeight="" ImageUrl="~/image/icone/OfficerMaschio16x16.png" ImageWidth="" UniqueName="icona">
                            </telerik:GridImageColumn>
                            <telerik:GridNumericColumn DataField="idrecord" DataType="System.Int32" DecimalDigits="0" FilterControlAltText="Filter idrecord column" ReadOnly="True" UniqueName="idrecord">
                            </telerik:GridNumericColumn>
                            <telerik:GridTemplateColumn DataField="cognome" FilterControlAltText="Filter cognome column" UniqueName="cognome" HeaderText="Cognome">
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn DataField="nome" FilterControlAltText="Filter nome column" UniqueName="nome" HeaderText="Nome">
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn DataField="cittadinanza" FilterControlAltText="Filter cittadinanza column" UniqueName="cittadinanza" HeaderText="Cittadinanza">
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn DataField="luogonascita" FilterControlAltText="Filter luogonascita column" UniqueName="luogonascita" HeaderText="Luogo nascita">
                            </telerik:GridTemplateColumn>
                            <telerik:GridDateTimeColumn DataField="datanascita" FilterControlAltText="Filter datanascita column" UniqueName="datanascita" HeaderText="Data">
                            </telerik:GridDateTimeColumn>
                            <telerik:GridTemplateColumn DataField="luogoresidenza" FilterControlAltText="Filter luogoresidenza column" UniqueName="luogoresidenza" HeaderText="Luogo residenza">
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn DataField="documento" FilterControlAltText="Filter Documento column" HeaderText="Documento" UniqueName="Documento">
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn DataField="ndocumento" FilterControlAltText="Filter ndocumento column" HeaderText="Numero" UniqueName="ndocumento">
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn DataField="luogodocumento" FilterControlAltText="Filter luogodocumento column" HeaderText="Luogo documento" UniqueName="luogodocumento">
                            </telerik:GridTemplateColumn>
                        </Columns>
 
                        <EditFormSettings>
                            <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
                        </EditFormSettings>
 
                        <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
                    </MasterTableView>
 
                    <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
 
                    <FilterMenu EnableImageSprites="False"></FilterMenu>
                </telerik:RadGrid>

I also need that if the field is sesse = 1 I have to upload the image column in this imamgine: ImageUrl = "~ / image/icone/OfficerMale16x16.png." If the field is sex = 2 I need to load this other ImageUrl = "~ / image/icone/OfficerFemale16x16.png."
How can I do it?
0
Maria Ilieva
Telerik team
answered on 18 Jul 2013, 08:37 AM
Hello Fabio,

In this online demo two separate methods are called for getting the grid data and its count. Check it out and let me know if it helps.

Regards,
Maria Ilieva
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Fabio Cirillo
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Fabio Cirillo
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or