G
Guest
I'm using a footer in my datagrid as an "add" row. I've read the current
postings and their links but am still having trouble adding the default of
"(select)" to the drropdownlist controls. I've tried:
mydddefectcodesF.Items.Insert(0, New ListItem("(please select)", ""))
mydddefectcodesF.Items.Insert(0, "Select One")
mydddefectcodesF.Items.FindByText("Select One").Value = 0
mydddefectcodesF.SelectedIndex = 0
in the Item created area, but no luck. I'm binding the dropdownlist via:
<FooterTemplate>
<asp
ropDownList id="dddefectcodesF" CssClass="gridtext" width="150"
DataSource="<%# BindDefectCodes() %>" DataTextField="DefectCode"
DataValueField="DefectCode_ID" runat="server" />
</FooterTemplate>
Public Function BindDefectCodes()
Dim objConn As SqlConnection = New SqlConnection(ConnectString)
Dim cmdDefectCodes As SqlCommand = New SqlCommand("SELECT DefectCode_ID,
DefectCode from view_DefectCodes", objConn)
cmdDefectCodes.CommandType = CommandType.Text
objConn.Open()
Return cmdDefectCodes.ExecuteReader(CommandBehavior.CloseConnection)
End Function
thanx!
postings and their links but am still having trouble adding the default of
"(select)" to the drropdownlist controls. I've tried:
mydddefectcodesF.Items.Insert(0, New ListItem("(please select)", ""))
mydddefectcodesF.Items.Insert(0, "Select One")
mydddefectcodesF.Items.FindByText("Select One").Value = 0
mydddefectcodesF.SelectedIndex = 0
in the Item created area, but no luck. I'm binding the dropdownlist via:
<FooterTemplate>
<asp
DataSource="<%# BindDefectCodes() %>" DataTextField="DefectCode"
DataValueField="DefectCode_ID" runat="server" />
</FooterTemplate>
Public Function BindDefectCodes()
Dim objConn As SqlConnection = New SqlConnection(ConnectString)
Dim cmdDefectCodes As SqlCommand = New SqlCommand("SELECT DefectCode_ID,
DefectCode from view_DefectCodes", objConn)
cmdDefectCodes.CommandType = CommandType.Text
objConn.Open()
Return cmdDefectCodes.ExecuteReader(CommandBehavior.CloseConnection)
End Function
thanx!