Do I have to use SelectIndex=<integer> to have the initial value selected in a DropDownList or ListBox?<BR><BR>I am using data from a table that only has one column that is text. <BR><asp:ListBox id="edit_R_Level" runat="server" Rows="1" DataTextField="Level" DataValueField="Level" /> <BR><BR>How do I make the correct entry selected (without using SelectIndex)? <BR><BR>Thank you<BR>AaronI can not get SelectIndex to work for a ListBox.<BR>Everything seems like it should work but it doesn't select the correct entry. It always starts on the first entry.<BR>I had a function that just returned 2 that I used for SelectIndex which did select the correct entry.<BR>I tried to extend this to be dynamic based on the row in the database.<BR>I am using an ArrayList and .Indexof() but it doesn't work.<BR><BR>Any help or suggestions would be greatly appreciated.<BR><BR>Thank you<BR>Aaron <BR><BR><%@ Import Namespace="System.Data" %><BR><%@ Import Namespace="System.Data.OleDb" %><BR><%@ Page Trace="True" %><BR><html><BR><BR><head><BR><script language="VB" Debug="true" runat="server"><BR><BR> Dim oConnection As OleDbConnection <BR> Dim oCommand As OleDbCommand<BR> Dim level_index as Integer <BR> Dim coursetype_index as Integer<BR> <BR> Dim LevelArray as ArrayList= new ArrayList() <BR> Dim CourseTypeArray as ArrayList= new ArrayList() <BR> <BR> Function GetLevel(TestStr as String)<BR> Dim i as Integer<BR><BR> for i = 0 to level_index<BR> if TestStr.ToString() = LevelArray(i).ToString then<BR> Trace.Write("i: " , i.ToString)<BR> Return i<BR> end if<BR> next<BR> <BR> end Function <BR> <BR> Sub Page_Load(Src As Object, E As EventArgs)<BR> <BR> Dim myReader as OleDbDataReader<BR> <BR> 'Create the connection <BR> oConnection = New OleDbConnection(ConfigurationSettings.AppSettings("constring")) <BR> oCommand = new OleDbCommand("select * from R_Level", oConnection)<BR> oCommand.Connection.Open() <BR> myReader = oCommand.ExecuteReader()<BR><BR> level_index = -1<BR> Trace.Write("level_index" ,level_index.ToString)<BR> do while (myReader.Read())<BR> level_index = level_index + 1<BR> LevelArray.Add(myReader("Level").ToString)<BR> Trace.Write("level_index" ,level_index.ToString)<BR> Trace.Write("Reader Level" ,myReader("Level").ToString)<BR> <BR> loop<BR> oCommand.Connection.Close() <BR> Trace.Write("'Lab'" ,LevelArray.Indexof("LAB").ToString)<BR><BR> oCommand = new OleDbCommand("select Type from R_CourseAccountsTypes", oConnection)<BR> oCommand.Connection.Open() <BR> myReader = oCommand.ExecuteReader()<BR><BR> coursetype_index = -1<BR> Trace.Write("coursetype_index" ,coursetype_index.ToString)<BR> do while (myReader.Read())<BR> coursetype_index = coursetype_index + 1<BR> CourseTypeArray.Add(myReader("Type").ToString)<BR> Trace.Write("coursetype_index" ,coursetype_index.ToString)<BR> Trace.Write("Reader Course Type" ,myReader("Type").ToString)<BR> <BR> loop<BR> oCommand.Connection.Close() <BR> Trace.Write("'support'" ,CourseTypeArray.Indexof("support").ToString)<BR><BR> If Not (IsPostBack)<BR> BindGrid()<BR> <BR> <BR> End If<BR> MyDataGrid.Columns(3).Visible = False ' Do not show the Password Column<BR><BR> <BR> End Sub<BR><BR> Sub MyDataGrid_Edit(Sender As Object, E As DataGridCommandEventArgs)<BR><BR> MyDataGrid.Columns(3).Visible = True ' Show the Password Column<BR> MyDataGrid.EditItemIndex = CInt(E.Item.ItemIndex)<BR> BindGrid() <BR> Dim CourseTypeListBox as ListBox <BR><BR> CourseTypeListBox = MyDataGrid.Items(CInt(E.Item.ItemIndex)).FindContr ol("edit_CourseType")<BR> 'Dim CourseTypeListBox as ListBox = E.Item.FindControl("edit_CourseType")<BR> <BR> ' dim sqlVar as String<BR> 'sqlVar = "select Type from R_CourseAccountsTypes " ' where Type = 'guest' order by Type Desc Union select Type from R_CourseAccountsTypes where Type <> 'guest' order by Type Desc" <BR> <BR> 'oCommand = New OleDbCommand(sqlVar, oConnection)<BR> 'You must open the connection before populating the DataReader<BR> 'oCommand.Connection.Open() <BR> 'Assign the DataSource property directly to the result<BR> 'of the ExecuteReader method.<BR> 'CourseTypeListBox.DataSource = oCommand.ExecuteReader(CommandBehavior.CloseConnec tion) <BR> CourseTypeListBox.DataSource = CourseTypeArray<BR> CourseTypeListBox.DataBind()<BR> 'oCommand.Connection.Close()<BR><BR> 'oCommand = New OleDbCommand("select * from R_Level", oConnection)<BR> 'You must open the connection before populating the DataReader<BR> 'oCommand.Connection.Open() <BR> 'Assign the DataSource property directly to the result<BR> 'of the ExecuteReader method.<BR> <BR> Dim LevelListBox as ListBox = MyDataGrid.Items(CInt(E.Item.ItemIndex)).FindContr ol("edit_R_Level") <BR> 'LevelListBox.DataSource = oCommand.ExecuteReader(CommandBehavior.CloseConnec tion)<BR> LevelListBox.DataSource = LevelArray <BR> LevelListBox.DataBind()<BR> <BR> <BR> 'oCommand.Connection.Close()<BR> <BR> End Sub<BR><BR> Sub MyDataGrid_Cancel(Sender As Object, E As DataGridCommandEventArgs)<BR><BR> MyDataGrid.EditItemIndex = -1<BR> BindGrid()<BR> End Sub<BR><BR> Sub MyDataGrid_Update(Sender As Object, E As DataGridCommandEventArgs)<BR><BR> If (Page.IsValid)<BR> 'BindGrid()<BR><BR> ' Dim DS As DataSet <BR> 'Dim oCommand As OledbCommand <BR> Dim PasswordVar as String<BR> <BR> Dim PasswordTextBox as TextBox<BR> PasswordTextBox = MyDataGrid.Items(CInt(E.Item.ItemIndex)).FindContr ol("edit_UserPassword") <BR><BR> <BR> if Len(PasswordTextBox.Text) > 0 then<BR> PasswordVar = "UserPassword = ?,"<BR> else<BR> PasswordVar = ""<BR> end if<BR> <BR> Dim UpdateCmd As String = "UPDATE D_CourseAccounts SET " & PasswordVar & " UserID = ?, CourseType = " _<BR> & " ?, R_Level = ? where ID = ?"<BR> <BR> oCommand = New OledbCommand(UpdateCmd, oConnection)<BR> <BR> If (Len(PasswordTextBox.Text) > 0)<BR> oCommand.Parameters.Add("UserPassword", PasswordTextBox.Text)<BR> Trace.Write("edit_UserPassword",PasswordTextBox.Text)<BR> oCommand.Parameters("UserPassword").Value = http://aspmessageboard.com/archive/index.php/PasswordTextBox.Text<BR> <BR> end if<BR><BR> <BR> Dim CurrentTextBox As TextBox<BR> Dim ColValue As String <BR> CurrentTextBox = MyDataGrid.Items(CInt(E.Item.ItemIndex)).FindContr ol("edit_UserID")<BR> 'E.Item.FindControl("edit_UserID")<BR> ColValue = CurrentTextBox.Text<BR> oCommand.Parameters.Add("UserID", ColValue)<BR> Trace.Write("edit_UserID" ,ColValue)<BR> oCommand.Parameters("UserID").Value = ColValue<BR><BR> <BR> Dim LevelListBox as ListBox = MyDataGrid.Items(CInt(E.Item.ItemIndex)).FindContr ol("edit_R_Level") <BR> Dim CourseTypeListBox as ListBox = MyDataGrid.Items(CInt(E.Item.ItemIndex)).FindContr ol("edit_CourseType") <BR><BR> 'CourseTypeListBox = E.Item.FindControl("edit_CourseType")<BR> ColValue = CourseTypeListBox.SelectedItem.Text<BR> oCommand.Parameters.Add("CourseType", ColValue)<BR> Trace.Write("edit_CourseType" ,ColValue)<BR> oCommand.Parameters("CourseType").Value = ColValue<BR> <BR> 'Dim LevelListBox as ListBox <BR> 'LevelListBox = E.Item.FindControl("edit_R_Level")<BR> ColValue = LevelListBox.SelectedItem.Text<BR> oCommand.Parameters.Add("R_Level", ColValue)<BR> Trace.Write("edit_R_Level" ,ColValue)<BR> oCommand.Parameters("R_Level").Value = ColValue<BR> <BR> <BR> <BR><BR> Dim TestValue as String<BR> TestValue = MyDataGrid.DataKeys(CInt(E.Item.ItemIndex))<BR> Trace.Write("MyDataGrid.DataKeys(CInt(E.Item.ItemIndex))",MyDataGrid.DataKeys(CInt(E.Item.ItemIndex)))<BR> Trace.Write("TestValue",TestValue)<BR> <BR> <BR> <BR> <BR> oCommand.Parameters.Add("ID", MyDataGrid.DataKeys(CInt(E.Item.ItemIndex)))<BR> oCommand.Parameters("ID").Value = MyDataGrid.DataKeys(CInt(E.Item.ItemIndex))<BR> <BR> 'oCommand = New OledbCommand(UpdateCmd, oConnection)<BR> <BR> oCommand.Connection.Open()<BR><BR> Try<BR> oCommand.ExecuteNonQuery()<BR> Message.InnerHtml = "<b>Record Updated</b><BR>" & UpdateCmd<BR> MyDataGrid.EditItemIndex = -1<BR> Catch Exp As OleDbException<BR> Trace.Write("Exp.Message",Exp.Message)<BR> Message.InnerHtml = "ERROR: A OleDbException." & UpdateCmd<BR> Message.Style("color") = "red"<BR> End Try<BR><BR> oCommand.Connection.Close()<BR><BR> BindGrid()<BR><BR> <BR> Else<BR> Message.InnerHtml = "ERROR: Please check each field for error conditions."<BR> Message.Style("color") = "red"<BR> End If<BR> End Sub<BR><BR> Sub BindGrid()<BR> Dim Spacer as String<BR> Dim DS As DataSet<BR> Dim oCommand As OleDbDataAdapter<BR> oCommand = new OleDbDataAdapter("select * from D_CourseAccounts", oConnection)<BR><BR> DS = new DataSet()<BR> oCommand.Fill(DS, "CourseAccounts")<BR><BR> MyDataGrid.DataSource=DS.Tables("CourseAccounts").DefaultView<BR> MyDataGrid.DataBind()<BR> <BR> End Sub<BR><BR></script><BR></head><BR><BR><body style="font: 10pt verdana"><BR><BR> <form runat="server"><BR><BR> <h3><font face="Verdana">Online Courses: Course Accounts</font></h3><BR><BR> <span id="Message" EnableViewState="false" style="font: arial 11pt;" runat="server"/><p><BR><BR> <ASPataGrid id="MyDataGrid" runat="server"<BR> Width="800"<BR> BackColor="#ccccff"<BR> BorderColor="black"<BR> ShowFooter="false"<BR> CellPadding=3<BR> CellSpacing="0"<BR> Font-Name="Verdana"<BR> Font-Size="8pt"<BR> HeaderStyle-BackColor="#aaaadd"<BR> OnEditCommand="MyDataGrid_Edit"<BR> OnCancelCommand="MyDataGrid_Cancel"<BR> OnUpdateCommand="MyDataGrid_Update"<BR> DataKeyField="ID"<BR> AutoGenerateColumns="false"<BR> ><BR><BR> <Columns><BR> <asp:EditCommandColumn EditText="Edit" CancelText="Cancel" UpdateText="Update" ItemStyle-Wrap="false"/><BR> <asp:BoundColumn HeaderText="ID" SortExpression="ID" ReadOnly="True" DataField="ID" ItemStyle-Wrap="false"/> <BR> <asp:TemplateColumn HeaderText="UserID" SortExpression="UserID"><BR> <ItemTemplate><BR> <asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "UserID") %>'/><BR> </ItemTemplate><BR> <EditItemTemplate><BR> <nobr><BR> <asp:TextBox runat="server" id="edit_UserID" Text='<%# DataBinder.Eval(Container.DataItem, "UserID") %>'/><BR> <asp:RequiredFieldValidator id="au_UserIDReqVal"<BR> ControlToValidate="edit_UserID"<BR> Display="Dynamic"<BR> Font-Name="Verdana" Font-Size="12"<BR> runat=server><BR> *<BR> </asp:RequiredFieldValidator><BR> </EditItemTemplate><BR> </asp:TemplateColumn> <BR> <asp:TemplateColumn HeaderText="Password" SortExpression="UserPassword" ><BR> <BR> <EditItemTemplate><BR> <asp:TextBox runat="server" id="edit_UserPassword" TextMode="Password" Text='<%# DataBinder.Eval(Container.DataItem, "UserPassword") %>'/><BR> </EditItemTemplate><BR> </asp:TemplateColumn><BR> <asp:TemplateColumn HeaderText="Course Type" SortExpression="CourseType"><BR> <ItemTemplate> <BR> <asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "CourseType") %>'/><BR> </ItemTemplate><BR> <EditItemTemplate> <BR> <asp:ListBox id="edit_CourseType" SelectIndex='<%# CourseTypeArray.Indexof(DataBinder.Eval(Container. DataItem, "CourseType")) %>' runat="server" Rows="1" /> <BR> <BR> </EditItemTemplate><BR> </asp:TemplateColumn><BR> <asp:TemplateColumn HeaderText="Level" SortExpression="R_Level"><BR> <ItemTemplate><BR> <asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "R_Level") %>'/><BR> <BR> </ItemTemplate><BR> <EditItemTemplate><BR> <asp:ListBox id="edit_R_Level" runat="server" Rows="1" SelectedIndex='<%# LevelArray.Indexof(DataBinder.Eval(Container.DataI tem, "R_Level")) %>' /> <BR> <BR> </EditItemTemplate><BR> </asp:TemplateColumn><BR> <asp:TemplateColumn HeaderText="Test Level" SortExpression="UserID"> <BR> <EditItemTemplate><BR> <asp:Label runat="server" Text='<%# LevelArray.Indexof(DataBinder.Eval(Container.DataI tem, "R_Level")) %>'/><BR> </EditItemTemplate> <BR> </asp:TemplateColumn> <BR> </Columns><BR><BR> </ASPataGrid><BR><BR> </form><BR><BR></body><BR></html>I figured it out!!<BR>I was trying to set the SelectedIndex after the data was Binded.<BR>Now I do it right before I call DatBind on the ListBox.<BR><BR>LevelListBox.DataSource = DataArray <BR>LevelListBox.SelectedIndex = select_index <BR>LevelListBox.DataBind()<BR><BR>Here is my code if there is a better way to do it I would love to know:<BR><BR><%@ Import Namespace="System.Data" %><BR><%@ Import Namespace="System.Data.OleDb" %><BR><%@ Page Trace="True" %><BR><html><BR><BR><head><BR><script language="VB" Debug="true" runat="server"><BR><BR> Dim oConnection As OleDbConnection <BR> Dim oCommand As OleDbCommand<BR> Dim myReader as OleDbDataReader<BR> Dim DataArray as ArrayList= new ArrayList() <BR> <BR> Sub Page_Load(Src As Object, E As EventArgs)<BR> <BR> 'Dim myReader as OleDbDataReader<BR> <BR> 'Create the connection <BR> oConnection = New OleDbConnection(ConfigurationSettings.AppSettings("constring")) <BR> <BR><BR> If Not (IsPostBack)<BR> BindGrid()<BR> <BR> <BR> End If<BR> MyDataGrid.Columns(3).Visible = False ' Do not show the Password Column<BR><BR> <BR> End Sub<BR><BR> Sub MyDataGrid_Edit(Sender As Object, E As DataGridCommandEventArgs)<BR><BR> MyDataGrid.Columns(3).Visible = True ' Show the Password Column<BR> MyDataGrid.EditItemIndex = CInt(E.Item.ItemIndex)<BR> BindGrid() <BR> <BR> Dim i as Integer<BR> Dim select_index as Integer<BR> <BR> Dim R_Level as String<BR> Dim CourseType as String<BR> Dim Sql2Var as String<BR> Sql2Var = "select R_Level, CourseType from D_CourseAccounts where ID = " & MyDataGrid.DataKeys(CInt(E.Item.ItemIndex))<BR> oCommand = new OleDbCommand(Sql2Var, oConnection)<BR> oCommand.Connection.Open() <BR> myReader = oCommand.ExecuteReader()<BR> myReader.Read()<BR> R_Level = myReader("R_Level")<BR> CourseType = myReader("CourseType")<BR> oCommand.Connection.Close() <BR><BR> Trace.Write("Sql2Var " ,Sql2Var)<BR> <BR> oCommand = new OleDbCommand("select * from R_Level", oConnection)<BR> oCommand.Connection.Open() <BR> myReader = oCommand.ExecuteReader()<BR><BR> i = -1<BR> <BR> do while (myReader.Read())<BR> i = i + 1<BR> if R_Level = myReader("Level").ToString then<BR> select_index = i<BR> Trace.Write("level select" ,select_index.ToString)<BR> end if<BR> DataArray.Add(myReader("Level").ToString)<BR> <BR> <BR> loop<BR> Dim LevelListBox as ListBox = MyDataGrid.Items(CInt(E.Item.ItemIndex)).FindContr ol("edit_R_Level") <BR> LevelListBox.DataSource = DataArray <BR> LevelListBox.SelectedIndex = select_index <BR> LevelListBox.DataBind() <BR> oCommand.Connection.Close()<BR> DataArray.Clear ' clear out the array<BR><BR> oCommand = new OleDbCommand("select Type from R_CourseAccountsTypes", oConnection)<BR> oCommand.Connection.Open() <BR> myReader = oCommand.ExecuteReader()<BR><BR> i = -1<BR> <BR> do while (myReader.Read())<BR> i = i + 1<BR> if CourseType = myReader("Type").ToString then<BR> select_index = i<BR> Trace.Write("CourseType select " , select_index.ToString)<BR> end if<BR> <BR> DataArray.Add(myReader("Type").ToString) <BR> loop<BR><BR> Dim CourseTypeListBox as ListBox = MyDataGrid.Items(CInt(E.Item.ItemIndex)).FindContr ol("edit_CourseType")<BR> CourseTypeListBox.DataSource = DataArray<BR> CourseTypeListBox.SelectedIndex = select_index <BR> CourseTypeLIstBox.DataBind() <BR> oCommand.Connection.Close()<BR> <BR> Trace.Write("R_Level" ,R_Level)<BR><BR> <BR> <BR> End Sub<BR><BR> Sub MyDataGrid_Cancel(Sender As Object, E As DataGridCommandEventArgs)<BR><BR> MyDataGrid.EditItemIndex = -1<BR> BindGrid()<BR> End Sub<BR><BR> Sub MyDataGrid_Update(Sender As Object, E As DataGridCommandEventArgs)<BR><BR> If (Page.IsValid)<BR> <BR> Dim PasswordVar as String<BR> <BR> Dim PasswordTextBox as TextBox<BR> PasswordTextBox = MyDataGrid.Items(CInt(E.Item.ItemIndex)).FindContr ol("edit_UserPassword") <BR><BR> <BR> if Len(PasswordTextBox.Text) > 0 then<BR> PasswordVar = "UserPassword = ?,"<BR> else<BR> PasswordVar = ""<BR> end if<BR> <BR> Dim UpdateCmd As String = "UPDATE D_CourseAccounts SET " & PasswordVar & " UserID = ?, CourseType = " _<BR> & " ?, R_Level = ? where ID = ?"<BR> <BR> oCommand = New OledbCommand(UpdateCmd, oConnection)<BR> <BR> If (Len(PasswordTextBox.Text) > 0)<BR> oCommand.Parameters.Add("UserPassword", PasswordTextBox.Text)<BR> Trace.Write("edit_UserPassword",PasswordTextBox.Text)<BR> oCommand.Parameters("UserPassword").Value = PasswordTextBox.Text<BR> <BR> end if<BR><BR> <BR> Dim CurrentTextBox As TextBox<BR> Dim ColValue As String <BR> CurrentTextBox = MyDataGrid.Items(CInt(E.Item.ItemIndex)).FindContr ol("edit_UserID")<BR> <BR> ColValue = CurrentTextBox.Text<BR> oCommand.Parameters.Add("UserID", ColValue)<BR> Trace.Write("edit_UserID" ,ColValue)<BR> oCommand.Parameters("UserID").Value = ColValue<BR><BR> Dim LevelListBox as ListBox = MyDataGrid.Items(CInt(E.Item.ItemIndex)).FindContr ol("edit_R_Level") <BR> Dim CourseTypeListBox as ListBox = MyDataGrid.Items(CInt(E.Item.ItemIndex)).FindContr ol("edit_CourseType") <BR> <BR> ColValue = CourseTypeListBox.SelectedItem.Text<BR> oCommand.Parameters.Add("CourseType", ColValue)<BR> Trace.Write("edit_CourseType" ,ColValue)<BR> oCommand.Parameters("CourseType").Value = ColValue<BR> <BR> ColValue = LevelListBox.SelectedItem.Text<BR> oCommand.Parameters.Add("R_Level", ColValue)<BR> Trace.Write("edit_R_Level" ,ColValue)<BR> oCommand.Parameters("R_Level").Value = ColValue<BR> <BR> Dim TestValue as String<BR> TestValue = MyDataGrid.DataKeys(CInt(E.Item.ItemIndex))<BR> Trace.Write("MyDataGrid.DataKeys(CInt(E.Item.ItemIndex))",MyDataGrid.DataKeys(CInt(E.Item.ItemIndex)))<BR> Trace.Write("TestValue",TestValue)<BR> <BR> oCommand.Parameters.Add("ID", MyDataGrid.DataKeys(CInt(E.Item.ItemIndex)))<BR> oCommand.Parameters("ID").Value = MyDataGrid.DataKeys(CInt(E.Item.ItemIndex)) <BR> oCommand.Connection.Open()<BR><BR> Try<BR> oCommand.ExecuteNonQuery()<BR> Message.InnerHtml = "<b>Record Updated</b><BR>" & UpdateCmd<BR> MyDataGrid.EditItemIndex = -1<BR> Catch Exp As OleDbException<BR> Trace.Write("Exp.Message",Exp.Message)<BR> Message.InnerHtml = "ERROR: A OleDbException." & UpdateCmd<BR> Message.Style("color") = "red"<BR> End Try<BR><BR> oCommand.Connection.Close()<BR><BR> BindGrid()<BR><BR> <BR> Else<BR> Message.InnerHtml = "ERROR: Please check each field for error conditions."<BR> Message.Style("color") = "red"<BR> End If<BR> End Sub<BR><BR> Sub BindGrid()<BR> Dim Spacer as String<BR> Dim DS As DataSet<BR> Dim oCommand As OleDbDataAdapter<BR> oCommand = new OleDbDataAdapter("select * from D_CourseAccounts", oConnection)<BR><BR> DS = new DataSet()<BR> oCommand.Fill(DS, "CourseAccounts")<BR><BR> MyDataGrid.DataSource=DS.Tables("CourseAccounts").DefaultView<BR> MyDataGrid.DataBind()<BR> <BR> End Sub<BR><BR></script><BR></head><BR><BR><body style="font: 10pt verdana"><BR><BR> <form runat="server"><BR><BR> <h3><font face="Verdana">Online Courses: Course Accounts</font></h3><BR><BR> <span id="Message" EnableViewState="false" style="font: arial 11pt;" runat="server"/><p><BR><BR> <ASPataGrid id="MyDataGrid" runat="server"<BR> Width="800"<BR> BackColor="#ccccff"<BR> BorderColor="black"<BR> ShowFooter="false"<BR> CellPadding=3<BR> CellSpacing="0"<BR> Font-Name="Verdana"<BR> Font-Size="8pt"<BR> HeaderStyle-BackColor="#aaaadd"<BR> OnEditCommand="MyDataGrid_Edit"<BR> OnCancelCommand="MyDataGrid_Cancel"<BR> OnUpdateCommand="MyDataGrid_Update"<BR> DataKeyField="ID"<BR> AutoGenerateColumns="false"<BR> ><BR><BR> <Columns><BR> <asp:EditCommandColumn EditText="Edit" CancelText="Cancel" UpdateText="Update" ItemStyle-Wrap="false"/><BR> <asp:BoundColumn HeaderText="ID" SortExpression="ID" ReadOnly="True" DataField="ID" ItemStyle-Wrap="false"/> <BR> <asp:TemplateColumn HeaderText="UserID" SortExpression="UserID"><BR> <ItemTemplate><BR> <asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "UserID") %>'/><BR> </ItemTemplate><BR> <EditItemTemplate><BR> <nobr><BR> <asp:TextBox runat="server" id="edit_UserID" Text='<%# DataBinder.Eval(Container.DataItem, "UserID") %>'/><BR> <asp:RequiredFieldValidator id="au_UserIDReqVal"<BR> ControlToValidate="edit_UserID"<BR> Display="Dynamic"<BR> Font-Name="Verdana" Font-Size="12"<BR> runat=server><BR> *<BR> </asp:RequiredFieldValidator><BR> </EditItemTemplate><BR> </asp:TemplateColumn> <BR> <asp:TemplateColumn HeaderText="Password" SortExpression="UserPassword" ><BR> <BR> <EditItemTemplate><BR> <asp:TextBox runat="server" id="edit_UserPassword" TextMode="Password" Text='<%# DataBinder.Eval(Container.DataItem, "UserPassword") %>'/><BR> </EditItemTemplate><BR> </asp:TemplateColumn><BR> <asp:TemplateColumn HeaderText="Course Type" SortExpression="CourseType"><BR> <ItemTemplate> <BR> <asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "CourseType") %>'/><BR> </ItemTemplate><BR> <EditItemTemplate> <BR> <asp:ListBox id="edit_CourseType" runat="server" Rows="1" /> <BR> <BR> </EditItemTemplate><BR> </asp:TemplateColumn><BR> <asp:TemplateColumn HeaderText="Level" SortExpression="R_Level"><BR> <ItemTemplate><BR> <asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "R_Level") %>'/><BR> <BR> </ItemTemplate><BR> <EditItemTemplate><BR> <asp:ListBox id="edit_R_Level" runat="server" Rows="1" /> <BR> <BR> </EditItemTemplate><BR> </asp:TemplateColumn><BR> <asp:TemplateColumn HeaderText="Test Level" SortExpression="UserID"> <BR> <EditItemTemplate><BR> <asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "R_Level") %>'/><BR> </EditItemTemplate> <BR> </asp:TemplateColumn> <BR> </Columns><BR><BR> </ASPataGrid><BR><BR> </form><BR><BR></body><BR></html><BR><BR> <BR><BR>