Last post Jul 30, 2007 01:43 PM by nick5454
Jul 30, 2007 12:21 PM|nick5454|LINK
I have a asp:Textbox and I have created an ObjectDataSource that I have created.
Is it possible to bind the textbox to that control thru the design view, without creating code? I want the textbox to display a field from my Business Object class that the Object Data Source control is providing.
Jul 30, 2007 12:29 PM|rmaiya|LINK
You can use FormParameter for your object data source and you can bind that to any form field. Follow this
Jul 30, 2007 12:34 PM|Freakyuno|LINK
The default .net asp textbox is not a databound control, and as such, there is no way to directly bind your textbox to the objectDataSource that you've droped onto your page, without writing code. If your goal is to stay out of the code-behind, you can
accomplish that, or if your goal is to keep the textbox outside a databound control, you can accomplish that as well - but not both unfortunatly. Here's a few examples:
1.) Put the textbox inside a repeater. I generally use a repeater because it's lightweight and serves as a great databinding wrapper.
<asp:repeater id="rptBusinessObject" runat="server" datasourceid="objectdatasource1">
<asp:textbox id="textbox1" runat="server" text='<%# Eval("fieldname") %>' />
You can do this without writing a single line of code. (it's harder in design view)
Jul 30, 2007 01:43 PM|nick5454|LINK
that is a great idea.