Gridview works in asp.net but not MVC asp.net

  • Thread starter Thread starter nigelwright7557
  • Start date Start date
N

nigelwright7557

Guest
I am trying to get a gridview to work in ASP and MVC.

Nothing appears at all and I get no errors or warning.

Any advice would be appreciated.

It works fine is standard asp but not MVC and asp.



<asp:GridView style="color:orange;word-wrap:break-word; background-color:blue" ID="GridView1" isEditMode = "true" runat="server" AutoGenerateColumns="False" DataKeyNames="Id" DataSourceID="SqlDataSource1" AutoGenerateEditButton="True" Caption="Customers" CaptionAlign="Top" CellPadding="0" HorizontalAlign="Center" AllowPaging="True">
<Columns>
<asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" SortExpression="Id" />
<asp:BoundField DataField="username" HeaderText="username" SortExpression="username" />
<asp:BoundField DataField ="pictureurl" HeaderText="pictureurl" SortExpression="pictureurl" />
<asp:BoundField DataField="timeup" HeaderText="timeup" SortExpression="timeup" />
</Columns>



<EditRowStyle HorizontalAlign="Center" />

<HeaderStyle CssClass="centerHeaderText" BorderStyle="Ridge" HorizontalAlign="Center" VerticalAlign="Middle"></HeaderStyle>
<PagerStyle HorizontalAlign="Center" />
</asp:GridView>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Database1ConnectionString2 %>"
SelectCommand="SELECT [Id], [username], [pictureurl], [timeup] FROM [ukcustomers] ORDER BY [timeup] DESC"
UpdateCommand="UPDATE [ukcustomers] SET [username] = @UserName, [pictureurl] = @pictureurl, [timeup] = @timeup WHERE [Id] = @Id" DeleteCommand="DELETE FROM [ukcustomers] WHERE [Id] = @Id" InsertCommand="INSERT INTO [ukcustomers] ([Id], [username], [pictureurl], [timeup]) VALUES (@Id, @UserName, @pictureurl, @timeup)"
>
<DeleteParameters>
<asp:Parameter Name="Id" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="Id" Type="Int32" />
<asp:Parameter Name="username" Type="String" />
<asp:Parameter Name="pictureurl" Type="String" />
<asp:Parameter Name="timeup" Type="String" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="username" Type="String" />
<asp:Parameter Name="pictureurl" Type="String" />
<asp:Parameter Name="timeup" Type="String" />
<asp:Parameter Name="Id" Type="Int32" />
</UpdateParameters>

</asp:SqlDataSource>






n.Wright

Continue reading...
 
Back
Top