[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 

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"


<AlternatingRowStyle BackColor="White" />


<asp:BoundField DataField="FID" HeaderText="FID" SortExpression="FID" >

<ControlStyle Font-Size="Small" />


<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:CommandField ShowDeleteButton="True" ShowEditButton="True"

Visible="True" />



<asp:SqlDataSource ID="SqlDataSource2" runat="server"


ConnectionString="<%$ ConnectionStrings:AAAAA %>"


SelectCommand="SELECT * FROM [my_inlagg] WHERE ([FID] = @FID)"



<asp:ControlParameter ControlID="DropDownList1" Name="FID"

PropertyName="SelectedValue" Type="Int64" />




Med vänliga hälsningar/Best Regards
Lars Ebeling


"I am not young enough to know everything."
-- Oscar Wilde

More information about the Mono-aspnet-list mailing list