473,568 Members | 2,755 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataView Error on Update With DropDownList

AG
Hi,
ASP.NET 2.0 web app

I have a GridView utilizing template columns and bound to an
objectdatasourc e.
In the edit template of one column there is a dropdownlist bound to another
objectdatasourc e.
The dropdownlist displays the appropriate values when entering edit mode.
However when I try to update, I receive the following error.

Databinding methods such as Eval(), XPath(), and Bind() can only be used in
the context of a databound control.

Here is the edititemtemplat e
<EditItemTempla te>
<asp:DropDownLi st id="ddlNetDataT ype" runat="server" EnableViewState ="False"
DataSourceID="o dsNetDataTypes" SelectedValue=' <%# Bind("NetDataTy pe") %>'
DataTextField=" NetDataType" DataValueField= "NetDataTyp e"></asp:DropDownLis t>
</EditItemTemplat e>

Can anyone offer a fix?

TIA

AG
Email: discuss at adhdata dot com


Nov 15 '06 #1
7 4530
Hi AG,

This is a known issue. The fix is to turn on ViewState of the DropDownList:

#ASP.NET Forums - Problem of binding SelectedValue to DropDownList in
templated DetailsView
http://forums.asp.net/1004263/ShowPost.aspx
This is a problem that we're aware of. The issue occurs because your
dropdownlists have viewstate turned off but your detailsview has it
enabled. You can either enable viewstate for your dropdownlists or disable
it for your detailsview, and the error should go away.

Let me know if this helps. Thanks.

Sincerely,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 16 '06 #2
AG
Walter,

Thanks for the response.

It probably makes no difference, but I am using a gridview, not a
detailsview. Sorry for the error in the subject of my post.
Turning on viewstate for the dropdownlist does prevent the error.
I would prefer to have it turned off.
I left viewstate turned on for the gridview because I am using paging and
thought that viewstate must be turned on in order to utilize paging. Is this
correct?

Are there plans to correct this issue?

--

AG
Email: discuss at adhdata dot com

"Walter Wang [MSFT]" <wa****@online. microsoft.comwr ote in message
news:LY******** ******@TK2MSFTN GXA01.phx.gbl.. .
Hi AG,

This is a known issue. The fix is to turn on ViewState of the
DropDownList:

#ASP.NET Forums - Problem of binding SelectedValue to DropDownList in
templated DetailsView
http://forums.asp.net/1004263/ShowPost.aspx
This is a problem that we're aware of. The issue occurs because your
dropdownlists have viewstate turned off but your detailsview has it
enabled. You can either enable viewstate for your dropdownlists or disable
it for your detailsview, and the error should go away.

Let me know if this helps. Thanks.

Sincerely,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your
reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no
rights.

Nov 16 '06 #3
Hi AG,

Regarding this case, apparently GridView and DetailsView all have the issue
as described in the forum post; thus for current moment using the
workaround of turning on ViewState of the DropDownList should be the only
way to get it working. Since this DropDownList only sends its ViewState
back to client browser when you're actually editing the row, it only
affects the page size in this case; it should not impact the page size when
user's viewing the GridView.

I'll go and check if there's any plan to fix it. Thank you for your
patience and understanding.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 17 '06 #4
AG
Thanks Walter.

I would still like to know if I must keep viewstate turned on for the
gridview.
As you stated, if I turn off viewstate for the gridview, then I can also
turn it off for the dropdownlist.
I do understand that the dropdownlist viewstate is only posted back when in
edit mode, but my actual case is that I am using a custom control that
inherits the gridview and provides an insert row to add a record. That row
also contains the same dropdownlist as my edit row, so viewstate is always a
factor.

So, the question at hand is:

If I turn off viewstate for the gridview, will I lose any functionality, or
will it simply need to be databound in each postback?
--

AG
Email: discuss at adhdata dot com

"Walter Wang [MSFT]" <wa****@online. microsoft.comwr ote in message
news:VQ******** *****@TK2MSFTNG XA01.phx.gbl...
Hi AG,

Regarding this case, apparently GridView and DetailsView all have the
issue
as described in the forum post; thus for current moment using the
workaround of turning on ViewState of the DropDownList should be the only
way to get it working. Since this DropDownList only sends its ViewState
back to client browser when you're actually editing the row, it only
affects the page size in this case; it should not impact the page size
when
user's viewing the GridView.

I'll go and check if there's any plan to fix it. Thank you for your
patience and understanding.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no
rights.

Nov 17 '06 #5
Hi AG,

Turning off viewstate for the GridView will work if it's rebound in each
postback. However, there're some known issues which you should be aware of:

#Scott on Writing
http://scottonwriting.net/sowblog/posts/10054.aspx
WARNING: Concurrency Issue with ASP.NET 2.0 GridViews/DetailsView/FormViews
that Support Editing and/or Deleting and Whose View State is Disabled
Also, I've consulted with product team on the issue, they're actually aware
of this issue (as noted in the forum post I referenced in my first reply);
however, since it's a rather difficult one, it just takes more time to fix
it and unfortunately we cannot tell exactly when will it be fixed. We're
sorry for the inconvenience and appreciate for your understanding.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '06 #6
AG
Thanks Walter,

For now, I will be leaving viewstate on for the gridview and dropdown.
I tried turning off viewstate for both and saw another problem.
The datasource for the gridview is a objectdatasourc e representating a
custom class that returns a dataview .
When I apply a filter to the objectdatasourc e and try to edit a row in the
gridview, the wrong row is edited.
A similar problem to the one you referenced. It seems that the gridview
references the full data source, and not just the filtered data when
viewstate is turned off.

--

AG
Email: discuss at adhdata dot com

"Walter Wang [MSFT]" <wa****@online. microsoft.comwr ote in message
news:ED******** ******@TK2MSFTN GXA01.phx.gbl.. .
Hi AG,

Turning off viewstate for the GridView will work if it's rebound in each
postback. However, there're some known issues which you should be aware
of:

#Scott on Writing
http://scottonwriting.net/sowblog/posts/10054.aspx
WARNING: Concurrency Issue with ASP.NET 2.0
GridViews/DetailsView/FormViews
that Support Editing and/or Deleting and Whose View State is Disabled
Also, I've consulted with product team on the issue, they're actually
aware
of this issue (as noted in the forum post I referenced in my first reply);
however, since it's a rather difficult one, it just takes more time to fix
it and unfortunately we cannot tell exactly when will it be fixed. We're
sorry for the inconvenience and appreciate for your understanding.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no
rights.

Nov 20 '06 #7
Hi AG,

Thank you very much for your update.

I would also suggest turning on viewstate for both the GridView and
DropDownList at current moment.

Again, you're welcome to submit your feedback at
http://connect.microsoft.com/Main/co...ContentID=2220 which
is monitored by our product team directly.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '06 #8

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

Similar topics

0
1219
by: wackyphill | last post by:
I loop thru a Filtered DataView and update several of the rows in the loop. The problem is once a ropw gets altered the DataView's Count Seems to be altered causing me to access rows that it doesn't think exist: DataView runView = new DataView( _db.DS.Tables, where, null, DataViewRowState.CurrentRows); foreach( DataRowView row in runView...
0
4782
by: Shane O. Pinnell | last post by:
I am sure this has come up before, but I haven't been able to find an answer as of yet. That said, any help is definitely appreciated! I have a datagrid populated from a dataset. I have a TemplateColumn with a DropDownList (DDL) in the FooterItemTemplate that is populated in the Page_Load event using a Sub Routine as the DataSource of the DDL....
17
2739
by: A_PK | last post by:
I have problem databinding the DataGrid with DataView/DataSet after the filter... I create the following proceudre in order for user to filter as many as they want, but the following code is only allow user to filter the first time, when they tried the second time, the speficied cast error message will prompt one.... I create a mydataset1...
4
1575
by: James | last post by:
Basically I have a DataGrid that I'm binding to the results of a stored procedure call. The recordset is fairly small. Initially I'm creating a DataSet from the results and binding it. There's a DropDownList on my page that filters the records that are displayed in the grid. How I'm currently handling this is when I initially bind, I...
3
6419
by: Elmo Watson | last post by:
I previously had a project working, in which the Gridview was populated by a DataSet - then, with a DropDownlist in one of the columns, using the OnrowDataBound event, to populate the DDL with the correct item in the returned data, I had : myDDL.SelectedValue = IIf(IsDBNull(MyDataSet.Rows(e.Row.RowIndex).Item("Fieldname")), vbNullString,...
0
828
by: shahDeveloper | last post by:
i have created a number of combo boxes according to my need.no i want to save the changes when any one click update button,but here the control did not find by findcontrol function. Dim i, j, totc As Long, FcNo As String, cmbcat As Object, fid As ArrayList catarry = New ArrayList catarry = CType(ViewState("catgs"), ArrayList) totc =...
1
3198
by: glbdev | last post by:
I searched around but cannot find an answer to this problem, if there is an answer. I have a DataView and a dropdownlist both on the same page. The dropdown list is a bound list of companies. The DataView shows the company details and you can delete a record, if necessary. If you change the selection on the dropdown list, the DataView is...
0
1044
by: AlDave | last post by:
What I'm trying display is after the user chooses the product (1st category) from a dropdown, then the dataview will display; The category any reports under that subcategory any reports under that
6
4260
by: Ahmedhussain | last post by:
Hi there, I m doing work on a gridview and Im getting an error: A potentially dangerous Request.Form value was detected from the client (ctl00$Content$GridView1$ctl03$TextBox1="<span class='txtColo...") Im using an access database. and when ever I try to update this it doesnt work. <%@ Page Language="C#" MasterPageFile="Mysite.master"...
0
7693
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7916
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7962
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5498
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2101
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 we have to send another system
1
1207
muto222
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.