Dotnet Gridview setup

Clever_Bob
Clever_Bob used Ask the Experts™
on
Hi all.

I want to import the contents of a webpage and dump it into a gridview, having used the split function to seperate the data into rows.

I'm not totally wedded to this approach so feel free to suggest alternatives

I have a simple Gridview

       
     <asp:GridView ID="GridView4" runat="server" >
            
                    <Columns> 
                             <asp:BoundField  HeaderText="Data"   /> 
            
             </Columns>
 </asp:GridView>

Open in new window



Then the codebeind

            WebClient webClient = new WebClient(); 

            string strUrl = "http://www.google.com/";

            string s = webClient.DownloadString(strUrl);

 string[] words = s.Split('<');

            // assign arraylist to the datasource

            

                GridView4.DataSource = s; 
            // binds the databind
                GridView4.DataBind(); 

Open in new window


This basically works but I get all my data returned like this (seems to split every character or more likely, I don't have the Gridview set up properly and its only accepting one character per column for some reason!)

      <
      !
      d
      o
      c
      t
      y
      p
      e
      
      h
      t
      m
      l
      >
      <
      h
      t
      m
      l
      
      i
      t
      e
      m
      s
      c
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You need to set the gridView datasource to the WORD not S

GridView4.DataSource = words;
GridView4.DataBind();

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial