开发者

Getting the data out of the data Formview

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开发者_如何学Python 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.


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") %>' />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜