473,396 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

aspx.vb SqlDataSource

Hello,

I dont know how to get a recordset from sqldatasource with
selectcommand and put in standard listbox (not html) when i press the
standard button.

Thank you

Dec 5 '05 #1
2 2020
Not sure what not HTML means or what standard button means, but...

You can think of the .NET 2.0 data sources controls as being akin to
the select statements themselves. That is, you "hit go" and BAM
something happens.

If you want automatical binding all you have to do is this...

<asp:ListBox ID="lstMyStuff" runat="server"
DataSourceID="sdsMyStuff" DataTextField="Something"
DataValueField="SomethingElse"></asp:ListBox>
<asp:SqlDataSource id="sdsMyStuff" runat="server"
SelectCommand="select * from..."></asp:SqlDataSource>
If you want this to be on demand, do the same with
lstMyStuff.DataBind( ) in the code behind.

If you don't want the list to show until button, have this in the code
behind.

lstMyStuff.Visible = true
lstMyStuff.DataBind( )

with the list set to Visible="false" in the declarative code.

David Betz
http://www.davidbetz.net/dynamicbliss/
http://www.davidbetz.net/winfx/

Dec 6 '05 #2
Thank you it's work. But I have one question more. How kan I change the
selectcommand on sqldatasource from standard (not html) button on event
click.

Thank you once again.
ag******@gmail.com напиша:
Not sure what not HTML means or what standard button means, but...

You can think of the .NET 2.0 data sources controls as being akin to
the select statements themselves. That is, you "hit go" and BAM
something happens.

If you want automatical binding all you have to do is this...

<asp:ListBox ID="lstMyStuff" runat="server"
DataSourceID="sdsMyStuff" DataTextField="Something"
DataValueField="SomethingElse"></asp:ListBox>
<asp:SqlDataSource id="sdsMyStuff" runat="server"
SelectCommand="select * from..."></asp:SqlDataSource>
If you want this to be on demand, do the same with
lstMyStuff.DataBind( ) in the code behind.

If you don't want the list to show until button, have this in the code
behind.

lstMyStuff.Visible = true
lstMyStuff.DataBind( )

with the list set to Visible="false" in the declarative code.

David Betz
http://www.davidbetz.net/dynamicbliss/
http://www.davidbetz.net/winfx/


Dec 10 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Martin Bischoff | last post by:
Hi, is it possible to modify the values of a SqlDataSource's select parameters in the code behind before the select command is executed? Example: I have an SqlDataSource with a...
8
by: Mike Kelly | last post by:
I've chosen to implement the "optimistic concurrency" model in my application. To assist in that, I've added a ROWVERSION (TIMESTAMP) column to my main tables. I read the value of the column in my...
3
by: adam222 | last post by:
hello, i have a web-form with a GridView control, i wanted to update & delete, using the AutoGenerateEditButton. when i used it with sqlDataSource (executing SP in the DB) it works like a...
3
by: Jim Andersen | last post by:
Just to let you know, and to help any future sorry sods who gets trapped in the same black hole...... You can't just copy/move a working sql-statement into a stored procedure. Working with a...
3
by: simonZ | last post by:
In gridView I have dropdown list : <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ProductID" DataSourceID="SqlDataSource1"> <Columns> <asp:BoundField...
4
by: Casper | last post by:
Hi, i know how to use datareader in code-behind, e.g. like this: Dim oConnection As OleDbConnection Dim comd As OleDbCommand Dim dtreader As OleDbDataReader oConnection = New...
2
by: Julien Sobrier | last post by:
Hello, I have 2 SqlDataSource on the same page that retrieve the same column names: <asp:SqlDataSource ID="SqlStructure" runat="server" SelectCommand="SELECT a, b FROM c WHERE d = 0 /> ...
0
by: staeri | last post by:
I have a dropdownlist attached to a SqlDataSource inside an Accordion. I receive the following error message when the SqlDataSource is inside the Accordion: "The DataSourceID of 'ddGroup' must...
5
by: Eric | last post by:
Hi, i tested this sql command directly with sql server and it works: select left(field1,10) from mytable Now, i tried the same in aspx file: i dragged a sqldatasource control and changed...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.