属性asp:Table设置为class或void

时间:2019-02-20 11:14:43

标签: c# asp.net

我是一个初学者,为什么在我的类和方法中没有可见的属性(id,class,table),要在代码中添加什么?

 protected void Search_Click(object sender, EventArgs e)
    {
        SearchWordDocument searchword = new SearchWordDocument();
        searchword.GetDocumentLibrary();
        //See atribute SearchResult
    }
    public class SearchWordDocument {
        //Create array document
        //Not see atribute SearchResult
        public void GetDocumentLibrary()
        {
         //Not see atribute SearchResult
        {
       }
<asp:Table ID="SearchResult" runat="server" Width="100%"> 
    <asp:TableRow>
        <asp:TableCell>Type</asp:TableCell>
        <asp:TableCell>Name</asp:TableCell>
        <asp:TableCell>Created</asp:TableCell>
    </asp:TableRow>
</asp:Table>

1 个答案:

答案 0 :(得分:1)

我想您的类应该从@echo off if (%1=="") (goto end) else (goto c1) :c1 if ("%2" =="") (goto error) else (goto c2) :c2 if ("%3" =="") (goto error) else (goto c3) :c3 if (%4=="") (goto c4) else (goto c4) :c4 if ("%1"=="a") (goto p1) else (goto conditions) :p1 if ("%2"=="b") (goto p2) else (goto conditions) :p2 if ("%3"=="C") (goto end) else (goto conditions) goto end :error echo "Error" goto fin :conditions echo "Error with parameters" :end 扩展,并且您还应该具有包含所有组件定义的局部类。

这是一个例子:

Page

现在,您应该在.aspx.cs之下有一个局部类,该类通常在扩展名.aspx.designer.cs下。此类将用于声明您的组件,如下所示:

<asp:GridView ID="GridView1" runat="server" AllowSorting="true" 
OnSorting="GridView1_Sorting">
    Your gridview here...
</asp:GridView>

那么您应该可以访问它。