Forum Moderators: open

Message Too Old, No Replies

How to configure sql data source from code view

not from design view?

         

belfasttim

1:23 am on Nov 11, 2009 (gmt 0)

10+ Year Member



Hi-- I'm developing over a network on a remote machine a few hundred miles from me. The design view of the page I'm working on won't load, it causes the remote desktop session to hang.

My question is-- is there any way to access the configure data source dialog from the source code view? Every resource I've found on the MSDN site says to "switch to design view" then configure the data source.

Thanks

marcel

6:09 am on Nov 11, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As far as I know it is not possible to access the dialog from the source code pane, but you can edit by hand.

You haven't mentioned which DataSource you are using so I have made a quick example with a SQLDataSource:

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:MyConnectionString %>"
SelectCommand="SELECT [Name], [County] FROM [CityInfo] WHERE ([Name] = @Name)">
<SelectParameters>
<asp:QueryStringParameter DefaultValue="belfast" Name="Name"
QueryStringField="city" Type="String" />
</SelectParameters>
</asp:SqlDataSource>

Intellisense will help you well here, just place the cursor within the control's markup code and press space, Intellisense will give you all of the available options.

You can also manipulate the DataSource properties from code-behind.