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

Data Versioning Via Table and RadGrid

1 Answer 50 Views
Grid
This is a migrated thread and some comments may be shown as answers.
TRACEY AXELROD
Top achievements
Rank 1
TRACEY AXELROD asked on 02 Jun 2010, 04:19 PM

Requirements

RadControls version

RadControls for ASP.NET AJAX 2010.1 519
.NET version

2.x
Visual Studio version

2005/8
programming language

VB.NET
browser support

all browsers supported by RadControls


PROJECT DESCRIPTION
I am storing different versions of an Excel file in a SQL Server table.  Each row in the file is a row in the table.  Different versions are differentiated by a VersionNumber column. This code allows the user to view different versions of the file in a RadGrid. Steps:

First you will need a table defined that includes a column for the version.  You will need a way to increment the version as you insert new rows to the table.  I use stored procedures to insert and select from the tables.
Then:
1. Have a radgrid defined to hold the data
2. Create a drop down and link buttons to select either a given version or the current version

<asp:DropDownList ID="ddlVersion" runat="server" Width="250px"
</asp:DropDownList> 
 
<asp:LinkButton ID="lbViewVersion" Text="View selected Version" runat="server"
</asp:LinkButton> 
<br /> 
<asp:LinkButton ID="lbViewCurrentVer" Text="View current Version" runat="server"
</asp:LinkButton> 

3. Create a method to pull the data based on the ddl and link button selections

    Protected Sub GetInventoryData(ByVal displayType As String
        ' set your data access here 
    ' ... 
        Dim inventoryData As DataSet 
        Try 
            ' If different version is selected get the version from the drop down and pass it into a stored procedure 
            If displayType = "diffVersion" Then 
                Dim inParams As New NameValueCollection 
                Dim version As Int16 
                version = ddlVersion.SelectedValue 
                With inParams 
                    .Add("@versionNum", version) 
                End With 
                inventoryData = <your data call to the stored procedure, passing in the version as input param> 
            Else 
        ' I go to a different table and procedure if it's current version so I need an else without input params 
                inventoryData = <your data call to the stored procedure> 
            End If 
            rgridInventory.DataSource = inventoryData 
            rgridInventory.DataBind() 
        Catch ex As Exception 
            ' your error catching protocol 
        Finally 
 
        End Try 
    End Sub 

4. Call the method -- passing in whether you want the current or earlier version. The example below gets a different version
' pulls in different version 
GetInventoryData("diffVersion"






1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 07 Jun 2010, 09:14 AM
Hello TRACEY,

Thank you for sharing your experience with us.
I converted the code library to a forum thread and I hope the other community users find your solution useful.

All the best,
Iana
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
TRACEY AXELROD
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or