Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating data using DataGrid

Status
Not open for further replies.

chuckh70

Programmer
Feb 4, 2004
71
0
0
US
Hello,

Below I have a very simple page I am pulling 4 fields which list in DataGrid. What I need to do is turn the Status into a list Box so that can select what the status should be.

is this possible? any examples I could be pointed to? most of what I found is just adding an edit, or delete button.

Code:
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Data" %>
<HTML>
	<script language="VB" runat="server">

    Sub Page_Load(Sender As Object, E As EventArgs)

        Dim MyConnection As SqlConnection = New SqlConnection("server=bksql04;database=invdb;uid=sa;pwd=System")
        Dim MyCommand As SqlCommand = New SqlCommand("SELECT DISTINCT sid AS MachineID, Name, Serial_Number, Status FROM machine_status WHERE (Status IS NULL)", MyConnection)

        MyConnection.Open()

        Dim dr As SqlDataReader = MyCommand.ExecuteReader()

        MyDataGrid.DataSource = dr
        MyDataGrid.DataBind()

        MyConnection.Close()
    End Sub

</script>
<body>
<h3><font face="Verdana">unassigned machines</font></h3>

<ASP:DataGrid id="MyDataGrid" runat="server" Width="700px" BackColor="#CCCCFF" 
BorderColor="Black"
CellPadding="3" 
Font-Name="Verdana" Font-Size="8pt" 
HeaderStyle-BackColor="#aaaadd" 
EnableViewState="False"
Font-Names="Verdana">
			
</ASP:DataGrid>
</body>
</HTML>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top