[Mono-aspnet-list] Populating gridview from SQLServer
Lars Ebeling
lars.ebeling at leopg9.no-ip.org
Wed Mar 14 07:49:35 UTC 2012
Dear All,
I am attending a course Visual Studio and C# at the University of Halmstad.
One task we have done is to create a Forum. But since I got a APache
webserver I want to test if I could use mono and Apache. A lot works, but I
have a small problem
I have a dropdownlist which I populate from a SQLServer table (works).
My problem: Depending on selected value in the dropdownlist I want to fill
the gridview.
I am running Mono on Ubuntu 10.04 LTS and Apache2. Sqlserver runs on Windows
XP.
This is source works with Visual Studio 2010
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False" CellPadding="4"
DataKeyNames="IID" DataSourceID="SqlDataSource2" ForeColor="#333333"
GridLines="None">
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField DataField="FID" HeaderText="FID" SortExpression="FID" >
<ControlStyle Font-Size="Small" />
</asp:BoundField>
<asp:BoundField DataField="IID" HeaderText="IID" InsertVisible="False"
ReadOnly="True" SortExpression="IID" />
<asp:BoundField DataField="datum" HeaderText="datum" SortExpression="datum"
DataFormatString = "{0:d} {0:t}" />
<asp:BoundField DataField="inlägg" HeaderText="inlägg"
SortExpression="inlägg" >
<ItemStyle Width="350px" />
</asp:BoundField>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True"
Visible="True" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:AAAAA %>"
OldValuesParameterFormatString="original_{0}"
SelectCommand="SELECT * FROM [my_inlagg] WHERE ([FID] = @FID)"
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="FID"
PropertyName="SelectedValue" Type="Int64" />
</SelectParameters>
</asp:SqlDataSource>
</p>
--
Med vänliga hälsningar/Best Regards
Lars Ebeling
Rentier
http://leopg9.no-ip.org
"I am not young enough to know everything."
-- Oscar Wilde
More information about the Mono-aspnet-list
mailing list