私のASPページで私は得た:
<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<asp:DropDownList ID="_SCP_ddlStatutDelais" runat="server"></asp:DropDownList>
<asp:TextBox ID="_SCP_tbTypeMiseProduction" Rows="3" runat="server" TextMode="MultiLine"></asp:TextBox>
<asp:Button ID="_btSend" runat="server" Text="Envoyer" CssClass="ms-ButtonHeightWidth"
onclick="_btSend_Click"/>
</asp:Content>
次に、コード ビハインドで、データベースから値を取得して、Page_Load で TextBox と DDL を提供し、動作します。
次に、ユーザーが値を変更してデータベースを更新したいので、TextBox でテキストを取得しようとしましたが、データベースから入力したテキストしか取得できず、myTextBox.Text はユーザーによるテキストの変更を無視します。
コードビハインド:
protected void _btSend_Click(object sender, EventArgs e)
{
Control context = this.Page.Master.FindControl("PlaceHolderMain");
//Informations Database Connection etc...
reflector.Set(d[fieldtomap],rootTypeDescriptor, ref instance, ((TextBox)(context.FindControl(nodeName))).Text);
//Submit update to database
}
たとえば、データベースから「Test」を取得した場合、TextBox「Test」に入れます。次に、ユーザーがこの値を変更し、ボタン ((TextBox)(context.FindControl(nodeName))) で検証します。テキストには常に「Test」が含まれ、ユーザーの変更は無視されます。