Entwickler-Ecke

ASP.NET und Web - DataGrid mit Daten füllen


Bergmann89 - Di 04.05.10 02:07
Titel: DataGrid mit Daten füllen
Hey,

ich bin grad dabei die Daten aus meiner SQL Datenbank irgendwie in ein DataGrid zu bringen. Aber irgendwie will das nich so wie ich will. Wenn ich den Code nehm, den ich HIER [http://www.aspheute.com/artikel/20030909.htm] gefunden hab, dann stehn zwar Daten im Grid, aber meine Formatierung und alles was ich vorher in der ASPX definiert hatte is weg. Am Ende soll es dann in etwa so wie HIER [http://www.aspheute.com/artikel/20040929.htm] aussehen.
So hab ich das DataGrid in der ASPX definiert:

XML-Daten
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
<asp:DataGrid 
  ID="DG_AccountData" 
  runat="server" 
  BackColor="LightGoldenrodYellow" 
  BorderColor="Firebrick" 
  BorderWidth="1px" 
  CellPadding="1" 
  ForeColor="Black" 
  GridLines="None" 
  AllowSorting="True">
  <FooterStyle 
    BackColor="Tan" 
    Font-Bold="False" 
    Font-Italic="False" 
    Font-Overline="False" 
    Font-Strikeout="False" 
    Font-Underline="False" />
  <SelectedItemStyle 
    BackColor="DarkSlateBlue" 
    ForeColor="GhostWhite" />
  <PagerStyle 
    BackColor="PaleGoldenrod" 
    ForeColor="DarkSlateBlue" 
    HorizontalAlign="Center" />
  <AlternatingItemStyle 
    BackColor="PaleGoldenrod" />
  <HeaderStyle 
    BackColor="Firebrick" 
    Font-Bold="True" />
  <Columns>
    <asp:BoundColumn HeaderText="Login">
      <HeaderStyle Width="50px" />
    </asp:BoundColumn>
    <asp:BoundColumn HeaderText="Name">
      <HeaderStyle Width="50px" />
    </asp:BoundColumn>
    <asp:BoundColumn HeaderText="Stadt">
      <HeaderStyle Width="50px" />
    </asp:BoundColumn>
    <asp:BoundColumn HeaderText="PLZ">
      <HeaderStyle Width="50px" />
    </asp:BoundColumn>
    <asp:BoundColumn HeaderText="Straße">
      <HeaderStyle Width="50px" />
    </asp:BoundColumn>
    <asp:BoundColumn HeaderText="Tel">
      <HeaderStyle Width="50px" />
    </asp:BoundColumn>
    <asp:BoundColumn HeaderText="eMail">
      <HeaderStyle Width="50px" />
    </asp:BoundColumn>
    <asp:EditCommandColumn 
      CancelText="Abbrechen" 
      EditText="Bearbeiten" 
      UpdateText="Aktualisieren">
    </asp:EditCommandColumn>
    <asp:ButtonColumn 
      CommandName="Delete" 
      Text="Löschen">
    </asp:ButtonColumn>
  </Columns>
</asp:DataGrid>

Den C#-Code hab ich mittlerweile wieder verworfen, denn der ging ja nich... Wäre echt toll, wenn mir da jmd helfen kann. Zumidest beim Ansatz.

MfG & Thx Bergmann.