G
Guest
I have a form that calls a stored procedure to perform updates to a table in
sqlserver.
When I have a dropdown with a list item value of nothing, the formview
control passes up the wrong value to the stored procedure. In some cases
this will be the primary key for my record and in a different dropdown on the
same page I may get the "*" symbol. I'm not sure what the problem is though.
NOte: I did have an issue setting up the formview control to use the stored
procedure type. I couldn't get it to work. (If you have the syntax that
would be greatly appreciated). If you set the UpdateommandType to Stored
Procedure, the "Update Query Command and Parameter Editor->QueryBuilder
Button" isn't smart enough to know that I don't want a select query. So, I
used the text type and used the following syntax "exec [myupdateproc]
@param1,@param2, @paramN.
I don't know if the two issues are related.
ANyway, in cases where my record has a null in the dropdown field [its not a
required field] I use the following code to select the null record for the
dropdown.
<aspropDownList ID="DDayoff" runat="server"
SelectedValue='<%#Bind("Dayoff") %>'>
<asp:ListItem Selected="True"></asp:ListItem>
<asp:ListItem>Mon</asp:ListItem>
<asp:ListItem>Tues</asp:ListItem>
<asp:ListItem>Wed</asp:ListItem>
<asp:ListItem>Thur</asp:ListItem>
<asp:ListItem>Fri</asp:ListItem>
</aspropDownList>
Am I doing something wrong here? What is the proper way to do this in a
formview control?
sqlserver.
When I have a dropdown with a list item value of nothing, the formview
control passes up the wrong value to the stored procedure. In some cases
this will be the primary key for my record and in a different dropdown on the
same page I may get the "*" symbol. I'm not sure what the problem is though.
NOte: I did have an issue setting up the formview control to use the stored
procedure type. I couldn't get it to work. (If you have the syntax that
would be greatly appreciated). If you set the UpdateommandType to Stored
Procedure, the "Update Query Command and Parameter Editor->QueryBuilder
Button" isn't smart enough to know that I don't want a select query. So, I
used the text type and used the following syntax "exec [myupdateproc]
@param1,@param2, @paramN.
I don't know if the two issues are related.
ANyway, in cases where my record has a null in the dropdown field [its not a
required field] I use the following code to select the null record for the
dropdown.
<aspropDownList ID="DDayoff" runat="server"
SelectedValue='<%#Bind("Dayoff") %>'>
<asp:ListItem Selected="True"></asp:ListItem>
<asp:ListItem>Mon</asp:ListItem>
<asp:ListItem>Tues</asp:ListItem>
<asp:ListItem>Wed</asp:ListItem>
<asp:ListItem>Thur</asp:ListItem>
<asp:ListItem>Fri</asp:ListItem>
</aspropDownList>
Am I doing something wrong here? What is the proper way to do this in a
formview control?