Hi,I've found all kinds of info on displaying data with various gridview, listview, dataview, etc. controls. What I cannot find is info on how to manually display the data without using a control. I was able to find this type of info for inserting data, i.e. "insertcommandtype" and "insertparameters" and made a working manual input form, but to display the data I'm coming up blank. I'm a rookie at this...I've learned a lot on my own...the internet is an endless resource, but I think maybe what I'm looking for is "outdated" i.e. why do it the hard way, manually, when it can be automated. So, what I'm looking for is simply how to retrieve the data and then display it in an aspx page. This is what I've been trying in my code behind:
.....
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim SqlDataSource1 As New SqlDataSource()
SqlDataSource1.ConnectionString = ConfigurationManager.ConnectionStrings("BarbConnec tionString").ToString()
SqlDataSource1.SelectCommandType = SqlDataSourceCommandType.Text
SqlDataSource1.SelectCommand = "Select * from BarbDatabase" 'Tried this on it's own
SqlDataSource1.SelectParameters.GetValues(HttpCont ext.Current, SqlDataSource1)
'SqlDataSource1.SelectParameters("Header") ToString
'SqlDataSource1.SelectParameters.GetValues(SqlData Source1) 'Header')
End Sub
and multiple variations of this (Header is the name of one of the db fields)
These I have tried in the aspx page:
<asp:TextBox ID="CentrePanelTextBox" runat="server" DataSourceID="SqlDataSource1" Text='<%# Bind("CentrePanel") %>'
TargetControlID="CentrePanelTextBox"/>
<asp:TextBox ID="HeaderTextBox" runat="server" Text="hello">
<asp:BoundField DataField="Header" HeaderText="Header" SortExpression="Header" />
</asp:TextBox>
And again every variation I could think of.
Or is it so much more complicated than this I should just stick with the controls?
.....
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim SqlDataSource1 As New SqlDataSource()
SqlDataSource1.ConnectionString = ConfigurationManager.ConnectionStrings("BarbConnec tionString").ToString()
SqlDataSource1.SelectCommandType = SqlDataSourceCommandType.Text
SqlDataSource1.SelectCommand = "Select * from BarbDatabase" 'Tried this on it's own
SqlDataSource1.SelectParameters.GetValues(HttpCont ext.Current, SqlDataSource1)
'SqlDataSource1.SelectParameters("Header") ToString
'SqlDataSource1.SelectParameters.GetValues(SqlData Source1) 'Header')
End Sub
and multiple variations of this (Header is the name of one of the db fields)
These I have tried in the aspx page:
<asp:TextBox ID="CentrePanelTextBox" runat="server" DataSourceID="SqlDataSource1" Text='<%# Bind("CentrePanel") %>'
TargetControlID="CentrePanelTextBox"/>
<asp:TextBox ID="HeaderTextBox" runat="server" Text="hello">
<asp:BoundField DataField="Header" HeaderText="Header" SortExpression="Header" />
</asp:TextBox>
And again every variation I could think of.
Or is it so much more complicated than this I should just stick with the controls?
No comments:
Post a Comment