gridview에 대한 간단한 예제를 작성했는데 그 이유는 알 수 없지만 gridview는 웹 사이트에 전혀 없습니다. 아무것도 ... http://ipic.su/img/img7/fs/example.1414716455.jpgSQL Server 데이터베이스에서 페이지로드시 gridview가 표시되지 않습니다.
누군가가 어떤 실수를 볼 수 - 여기
내가 브라우저에서 무엇을 얻을 그림이 무엇입니까?<%@Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Site.Master" CodeFile="InvoiceEdit.aspx.cs" Inherits="InvoiceEdit" EnableEventValidation="false" %>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<style>
.gridview
{
background: red;
border:dashed 1px blue;
}
</style>
<asp:GridView ID="gvInvoice" runat="server"
AutoGenerateColumns="False"
OnRowDataBound="gvInvoice_RowDataBound"
DataKeyNames="InvoiceID"
AutoGenerateEditButton="False"
CellPadding="1" Width="100%"
datasourceid="SqlDataSource1"
CssClass ="gridview">
<Columns >
<asp:BoundField HeaderText="InvoiceID" DataField="InvoiceID" ReadOnly="true" />
<asp:BoundField HeaderText="RechnNummer" DataField="RechnNummer" ReadOnly="true" />
<asp:BoundField HeaderText="Kunde" DataField="Kunde" ReadOnly="true" />
<asp:BoundField HeaderText="Text" DataField="Text" ReadOnly="true"/>
</Columns>
</asp:GridView>
----TEST TEXT----
<asp:sqldatasource id="SqlDataSource1"
selectcommand="Select * from Invoice where InvoiceID = @InvoiceID"
updatecommand="Update Invoice set RechnNummer = @RechnNummer, [email protected], [email protected], [email protected], [email protected],
[email protected], [email protected], [email protected] where InvoiceID = @InvoiceID"
connectionstring="<%$ ConnectionStrings:Invoice%>"
runat="server" >
<SelectParameters>
<asp:ControlParameter ControlID="gvInvoice" PropertyName="SelectedValue" Name="InvoiceID" />
</SelectParameters>
<UpdateParameters>
<asp:ControlParameter ControlID="gvInvoice" PropertyName="SelectedValue" Name="InvoiceID" />
</UpdateParameters>
</asp:sqldatasource>
</asp:Content>
코드 숨김이 거의 비어 있지만 문제가되지 않는다고 생각합니다. 라이브러리가 누락 되었습니까? 또는 무엇이 잘못 되었습니까? 대답 주셔서 감사합니다!
public partial class InvoiceEdit : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void gvInvoice_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "this.originalstyle=this.style.backgroundColor;this.style.backgroundColor='#C2C2C2'");
e.Row.Attributes.Add("onmouseout","this.style.backgroundColor=this.originalstyle;");
e.Row.Attributes["style"] = "cursor:pointer";
}
}
}
데이터 소스를 확인하십시오. 어떤 데이터가 있습니까? – Sam
이 그림을 보시라. http://ipic.su/img/img7/fs/example.1414719295.jpg 디자인 모드를 사용하면 gridview를 볼 수는 있지만 편집 할 수 없다 ... hm . 슬프게도,하지만 내가 어떤 오류가 발생하지, 그것은 처음으로 내게 일어납니다 – Therapyx
디자인 모드는 단지 당신에게 몇 가지 더미 데이터를 보여줍니다. 데이터베이스에서 데이터를 가져 오는 것은 아닙니다. 데이터 원본을 살펴보십시오. 연결 문자열은 어디에 있습니까? 그 정확한지 확인하십시오 – Sam