473,473 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Updates query and Dropdowns in a formview

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.
<asp:DropDownList 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>

</asp:DropDownList>

Am I doing something wrong here? What is the proper way to do this in a
formview control?
--
Jas
Jan 17 '06 #1
4 1795
Just wanted to update: I added the UpdateCommandType="Stored Procedure" And
changed the syntax of the update statement accordingly and this did not fix
the problem.

Also, I've noticed that the same thing happens for any bound control in the
editItemTemplate. If I leave any field blank, it will pass the primary key
in place of the null value.
Jan 17 '06 #2
I found a solution and wanted to post it for anyone having the same problem.

In the Command and Property Editor, you have to set the
ConvertEmptyStringToNull parameter to false. If you leave it true, something
gets messed up between the formview and the sqldatasource and it assigns the
value as your primary key.

Jan 18 '06 #3
I feel your pain. This was my whole day today. I'm just trying to access the
properties of ANY web controls within a FormView control.

I have a FormView control with a dropdownlist control bound to a lookup
table. I want to add "Select..." as the first option in the dropdown. Piece
of cake outside a FormView, but completely stumping me within.

Its KILLING ME!!!!!
"DXJas" wrote:
I found a solution and wanted to post it for anyone having the same problem.

In the Command and Property Editor, you have to set the
ConvertEmptyStringToNull parameter to false. If you leave it true, something
gets messed up between the formview and the sqldatasource and it assigns the
value as your primary key.

Jan 25 '06 #4
I have to say I'm beginning to hate some of these new controls. I keep
running into little things that you think should work a certain way but they
don't.

Today it was the Gridview in Asp.net. That sucker doesn't use the rowstyle.
I set the borderstyle and border color and nothing... What the heck.

And am I the only one that has noticed the buggy Properties pane? There has
got to be a bug in that thing. It is not tracking focus correctly.
Feb 4 '06 #5

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

Similar topics

3
by: sck10 | last post by:
Hello, I am creating a form for users to enter information about a lab and the members of the lab. I have one form (FormView) that they use to enter information about that lab. The keyvalue is...
1
by: SomebodyElse | last post by:
Hi. Apologies if this has been asked here before - I've searched & searched but can't find anything. It's probably my serach parameters, but I'm having trouble even describing it to a search...
3
by: Marcial | last post by:
Greetings all! After a week of toiling I've finallay decided to post the code below with hopes that someone can point out my error(s). Basically I have a Gridview/Formview on a ASP.NEt 2.0...
4
by: J055 | last post by:
Hi I have 2 update buttons in my FormView ('Apply' and 'OK'). I want both buttons to update the data source but the 'OK' button should redirect afterwards. I can see which button is clicked...
1
by: rodchar | last post by:
hey all, if i want the user to only be able to add one record on the formview what's the best way to do this? they can edit current record but not add more than one. they can also delete that one...
2
by: sck10 | last post by:
Hello, I have 3 objects: LinkButton GridView FormView The LinkButton is used to open the FormView in Insert mode. The GridView provides a list of products. When the "Select" link is
3
by: ravitunk | last post by:
hi..I have to write a query to retrieve records from few tables.....the query has 5 parameters(in where clause) which are passed from the ASP.net page and the user may send one or more parameters...
3
by: techmistress | last post by:
Hello, I have a search function, that seems to return all of the records, rather than the ones I query (based on a form). I could use help to find out where I am wrong! $sql = "select * from...
4
by: zion4ever | last post by:
Hello good people, Please bear with me as this is my first post and I am relative new to ASP. I do have VB6 experience. I have a form which enables users within our company to do an intranet...
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...
1
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.