Access Control in DataSource

M

myzm

Hi,

I have a FormView looks like this
<asp:FormView>
<ItemTemplate>
<asp:Table>
<asp:TableRow>
<asp:TableCell>
<asp:TextBox ID="textBox1">
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</ItemTemplate>
</asp:FormView>

I want to reference the TextBox in DataSource parameters.

<asp:ObjectDataSource UpdateMethod="UpdateDistrict">
<UpdateParameters>
<asp:ControlParameter Name="ID" ControlID="TextBox1"
PropertyName="Text" />
</UpdateParameters>
</asp:ObjectDataSource>

How can do it? Thanks.
 
G

Guest

If you put the DataSource control inside the the ItemTemplate the it will be
able to "see" the TextBox. Otherwise i think you will have to set the
parameter value from the DataSource programatically by using something like

TextBox MyTextBox = (TextBox)BoxFormView.Findcontrol("TextBox1");
Parameter=MyTextBox.Text;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top