tags:

views:

19

answers:

1

I have an ASP pg with a formview list control on it that hooks up to a sql database customer table

I want to access the customer name outside the form.

How do I:

A) access the bound text box in the form view template? Something like Text1.text=formview1.customername.text (that doesn't work but that's the kinda thing)

B) access the database field in the table that the sqlsource connects to to feed the formview

Really appreciate the help. I bet it's easy to do but I'm just not getting there.

A: 

You are going to want to use the DataBinder Class. For example:

<asp:formview id="formViewContainer" ... other code>
    ..... formview code .....
    <%# Eval("CustomerName") %>
    ..... more formview code .....
</asp:formview>

Then to access "CutomerName" outside of the formview use the DataBinder as follows:

<asp:textbox id="customerName" runt="server" 
             text='<%# DataBinder.GetPropertyValue(formViewContainer.DataItem, "CustomerName") %>' />
Angel Brighteyes