Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML to DataGrid ok - now what?

Status
Not open for further replies.

roleki

Technical User
Sep 5, 2007
22
0
0
US
I'm using VB.NET (2005) to set up a 'home page' for what will eventually be a slew of single-page reports on our corporate intranet site.

I don't want to be bogged down with a lot of table editing when I go to put a report up for consumption, so I thought I'd just have a simple DataGrid with report name/description/URL, populated by an XML file.

I've got the mechanics of bringing the XML into the DataGrid down, but I don't like the look of having the URL in a separate column.

How would I go about having a two columns, with the Report Name hyperlinked, and the Description as 'plain text'? Also, if at all possible I would like the report to load in the same window that called it, but all I know how to do is to open a new window. Any pointers on that would also be appreciated.

Here's what I have so far...

(Relevant .aspx code)
Code:
<html>
[...]
<tr >
<td align="center">
 <asp:DataGrid
   runat="server"
   ID="dgGAReports"
   SkinID="MainDG"
   AutoGenerateColumns="false">
  <Columns>
   <asp:BoundColumn 
    DataField="ReportName" 
    HeaderText="Report Name">
   </asp:BoundColumn>
   <asp:BoundColumn 
    DataField="ReportDescription"
    HeaderText="Report Description">
   </asp:BoundColumn>
   <asp:HyperLinkColumn 
    DataTextField="ReportURL" 
    DataNavigateURLFormatString="javascript:var w=window.open('details.aspx?id={0}', '', 'width=1280,height=250,left=0,top=25,directories=no,location=no,menubar=no,status=no,toolbar=no,resizable=yes,scrollbars=yes');"
    DatanavigateURLField="ReportURL"
    HeaderText="Link">
   </asp:HyperLinkColumn>
  </Columns>
 </asp:DataGrid></td>            
</tr>
[...]
</html>

And the CodeFile...

Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  
  Dim tGADataSet As New DataSet()
  tGADataSet.ReadXml("\\ReportServer\GAR\GAReportURLS.xml")
  dgGAReports.DataSource = tGADataSet
  
  dgGAReports.DataBind()
  lblGA.Text = "Finished Reports"
End Sub

And the XML file...
Code:
<?xml version="1.0" encoding="utf-8" ?>
<ReportList>
  <BetaReport>
    <ReportName>Summary Overview GA</ReportName>
    <ReportDescription>This is an overview of the summary information.</ReportDescription>
    <ReportURL>\\ReportServer\GAR\GASummary.aspx</ReportURL>
  </BetaReport>

  <BetaReport>
    <ReportName>Overview Summary GA</ReportName>
    <ReportDescription>This is a summary of the overview information.</ReportDescription>
    <ReportURL>\\ReportServer\GAR\GAOverview.aspx</ReportURL>
  </BetaReport>
</ReportList>

Sorry to be so verbose, I'm just kind of stuck for ideas here.

 
You should repost this question in forum855 forum. You'll be much more likely to get an answer to this question there.


I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top