在cs 页面无法这样写 this+控件名   控件在aspx页面中,刚弄asp.net 没多久,个位请教了!!!goodStyle2.aspx页面代码:<%@ Page Language="C#" AutoEventWireup="true" Async="true" CodeFile="goodStyle2.aspx.cs" EnableViewState="false"  Inherits="goodStyle2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>class</title>
    <script type="text/javascript" src="../JScripts/checkFrame.js"></script>    <script type="text/javascript" >
       其中的代码省略......    </script>
</head>
<body oncontextmenu="event.returnValue=false">
<asp:SqlDataSource ID="SqlWareHousesDetails" runat="server" ConnectionString="<%$ ConnectionStrings:GYSConnectionString %>" SelectCommand="SELECT * FROM Goods WHERE (GF = 0)"  UpdateCommand="sp_updateWareHouse" UpdateCommandType="StoredProcedure" ProviderName="<%$ ConnectionStrings:GYSConnectionString.ProviderName %>"  >
     <UpdateParameters>
        <asp:Parameter Name="Quota" Type="String" />
        <asp:Parameter Name="InsertIDList" Type="String" />    </UpdateParameters>
</asp:SqlDataSource>
<form id="form1" runat="server" language="javascript" ondblclick="return form1_ondblclick()" >
<asp:HiddenField ID="hidLeftID" runat="server" />
<asp:HiddenField ID="hidInsertID" runat="server" />
<asp:HiddenField ID="hidDeleteID" runat="server"  />
<asp:HiddenField ID="hidGClaID" runat="server"  Value='<%# Request.QueryString["MOID"]%>'/>
<asp:FormView ID="FormViewWareHouses" runat="server"  DataSourceID="SqlWareHousesDetails" Width="100%" DefaultMode="Edit" Height="254px" OnItemUpdating="FormViewWareHouses_ItemUpdating" >
    <EditItemTemplate>
        <table width="100%" ><tr>
            <td align="left" style="height: 45px">目录编号:</td>
            <td style="width: 21%; height: 45px;">
<asp:TextBox ID="txtWareHouseCode" runat="server"   Text='<%# Request.QueryString["MOID"]%>' ></asp:TextBox>              
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtWareHouseCode" ErrorMessage="请输入编号!" ValidationGroup="QuantityValid" Display="Dynamic"></asp:RequiredFieldValidator>                
            </td>
            <td style="width: 20%; height: 45px;">名称:</td>
<td style="height: 45px"><asp:TextBox ID="txtDescription" runat="server" Text='<%# Request.QueryString["MOIDName"]%>'></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"  ControlToValidate="txtDescription"  ErrorMessage="请输入名称!" ValidationGroup="QuantityValid" Display="Dynamic"></asp:RequiredFieldValidator>                            
            </td>
        </tr>
        </table>
        <table width=100%>
        <tr>
        <td style="height: 21px">物资分类:</td>
        <td style="height: 21px; width: 71px;"></td>
        <td style="height: 21px; width: 244px;">本库可存放物资:</td>
        </tr>
        <tr>
            <td width=40% style="height: 193px">
                <asp:SqlDataSource ID="SqlSparesCatogries" runat="server" ConnectionString="<%$ ConnectionStrings:GYSConnectionString %>"
                    SelectCommand="SELECT [Gid],([Gid]+ ',' + [GName ] + ','+ ' ' + [Gstyle]) AS MAX  FROM [Goods] WHERE ([GDl] = 1 ) ORDER BY [Gid]" ProviderName="<%$ ConnectionStrings:GYSConnectionString.ProviderName %>">
                </asp:SqlDataSource>
                <asp:ListBox ID="ListSparesCatogries" runat="server"  Width=100% Rows=10  DataSourceID="SqlSparesCatogries" DataTextField="MAX"  DataValueField="Gid"  SelectionMode="Multiple"  >
                    <asp:ListItem></asp:ListItem>
                </asp:ListBox>
            </td>
            <td align=center valign=middle style="width: 71px; height: 193px;">
                <input type=button value="添加>>" OnClick="moveoption(FormViewWareHouses_ListSparesCatogries, FormViewWareHouses_ListWareHouseItemCatogries, true);" />
                <br /><br /><br />
                <input type=button value="<<删除" onclick="moveoption(FormViewWareHouses_ListWareHouseItemCatogries, FormViewWareHouses_ListSparesCatogries, false);"/>
            </td>
            <td style="width: 244px; height: 193px;">
                <asp:SqlDataSource ID="SqlWareHouseItemCatogries" runat="server" ConnectionString="<%$ ConnectionStrings:GYSConnectionString %>" SelectCommand="<%=Request.Cookies["MOID"]%>">
                </asp:SqlDataSource>
                <asp:ListBox ID="ListWareHouseItemCatogries" runat="server" Width="98%" Rows=10  DataSourceID="SqlWareHouseItemCatogries" DataTextField="MAX"  DataValueField="Gid" SelectionMode="Multiple"  >
                </asp:ListBox>
            </td>
        </tr>
        <tr><td align=right style="height: 21px">              
        <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" ValidationGroup="QuantityValid" CommandName="Update" Text="保存更改"  OnClientClick="return getInsertIDList(FormViewWareHouses_ListWareHouseItemCatogries);" >
        </asp:LinkButton>
        </td>
        <td style="width: 71px; height: 21px"></td>
        <td align=left style="width: 244px; height: 21px">
        <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
            Text="取消">
        </asp:LinkButton>
        </td></tr>
        </table>
    </EditItemTemplate>
</asp:FormView>
    &nbsp;
</form>
</body>
</html>goodStyle2.aspx.cs页面using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Drawing;public class MessageBox
{
    public MessageBox()
    {
        //
        // TODO: 在此处添加构造函数逻辑
        //
    }
    public static void Show(System.Web.UI.Page page, string message)
    {
        string key = "message";
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        sb.Append(" alert(' ");
        sb.Append(message);
        sb.Append(" ');window.location.reload();");
        Type cstype = page.GetType();
        ClientScriptManager cs = page.ClientScript;
        if (!cs.IsStartupScriptRegistered(key))
        {
            cs.RegisterStartupScript(cstype, key, sb.ToString(), true);
        }
    }}
public partial class goodStyle2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
       
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
        if (!IsPostBack)
        {
            SqlWareHouseItemCatogries.SelectCommand="SELECT Gid, Gid + ',' + [GName ] + ',' + ' ' + Gstyle AS MAX FROM Goods WHERE (GCla = '<%# Request.QueryString["MOID"]%>') AND (GDl = '0') ORDER BY Gid">
///这里不显示控件名??
         
                   }    }    //Insert new SparesCategory into specific WareHouse
    
  ........................       }
}