我有一個templatefield在templatefield中有一個文本框和filteredtextboxextender。我需要在c#代碼隱藏中將filteredtextboxextender的ValidChars屬性從「123」更改爲「abc」。 templatefield在GridView裏面。 我在aspx頁面中使用了下面的代碼。如何變更模板字段內控件的屬性?
<asp:GridView ID="grdEducation" runat="server" AllowSorting="True" AutoGenerateColumns="False"
AllowPaging="false" CellPadding="4" GridLines="Vertical" OnRowDeleting="grdEducation_RowDeleting"
OnRowDataBound="grdEducation_RowDataBound" OnRowUpdating="grdEducation_RowUpdating" ShowFooter="false" ShowHeader="true">
<HeaderStyle CssClass="grid-header-style" />
<Columns>
<asp:TemplateField HeaderStyle-CssClass="grid-label-small" >`
<ItemTemplate>
<table>
<tr>
<td width='90%'>
<table>
<td width='60%'>
<asp:TextBox ID="textbox1" Width="100px" runat="server"
ToolTip="Provide text" MaxLength="11"></asp:TextBox>
<ajaxtoolkit:FilteredTextBoxExtender ID="filter" runat="server" TargetControlID="textbox1"
ValidChars="123" />
</td>
</table>
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
有沒有可能改變像這樣的filteredtextboxextender屬性?
謝謝。
哪些數據綁定控件? – Pankaj 2012-04-12 18:51:15
請顯示你的.. gridview的代碼?和模板字段以及您要修改的文本框。還顯示任何你已經嘗試過的代碼。 – 2012-04-12 18:57:17