In an earlier thread, I was asking for help on "Invalid attempt to
FieldCount when reader is closed" error when I was using a dataset rather
than a datareader to bind to a datagrid.
After playing around with it, I found out that the error was caused by
template columns. Once I remove template columns, everything worked fine.
Here are my scenarios and I would appreciate input on it.
My datagrid is bound to a orderlines table. In the edit mode, I want to
allow user to select product from a drop down list.
The steps I have followed are as follows:
(1) Turn the product model column into a template column.
(2) Edit this template column to include an unbound drop down box (called
DDLModelNumber) in the edit template mode. Originally I also had a drop down
box in the item template mode. However, this would cause the invalid field
count error when the form first loads.
(3) In the ItemCreated event, I would use
e.item.findcont rol("DDLModelNu mber") to determine whether I am in edit mode.
If I am, then I would populate the drop down list, and then set its
SelectedIndex to the current selection.
(4) On update event, I would write the change back to the server by grabbing
the value from DDLModelNumber.
However, I found that I get this dreaded Invalid Field Count error after I
click edit on the datagrid (which would firstly populate the grid, as well
as the DDLModelNumber drop down box, and then attempt to DataBind). For some
reason, when calling databind method, if I have a drop down list in the
template, it causes this invalid field count error.
I would appreciate input on (1) how to get around this drop down list
conflict with databind operations and (2) whether the method I am using is
the best way to achieve the functionalities I am after.
Thanks in advance 2 1530
Hi,
What's the AutoGenerateCol umns value of your datagrid
Can you show your code
Bin Song, MCP
AutoGenerateCol umns is false.
I found a few articles from MSDN website, and now have got it working.
Thanks for the help.
"Bin Song, MCP" <an*******@disc ussions.microso ft.com> wrote in message
news:7E******** *************** ***********@mic rosoft.com... Hi,
What's the AutoGenerateCol umns value of your datagrid? Can you show your code?
Bin Song, MCP This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Andrea Trevisan |
last post by:
That's a revival of a known thing I suppose.I hope it's useful.
My problem was:
I want to have a DataGrid with two Template columns: first with
TextBox,second with Button.I want to fire an event from
button and I want to have a reference to TextBox to make use of it.The
most difficult was the reference to TextBox.
This sample is taken from MCAD/MCSD Exam 70-305/70-315 of Microsoft
Press.This book is much more exhaustive than the brief...
|
by: |
last post by:
I have a datagrid with a template column that has a hyperlink and a label.
The hyperlink text is bound to Title from my dataset and the label text is
bound to Author in the dataset. The grid displays with the template columns
showing the Title and the Author from the first row in all rows. The other
none template columns are fine. Obviously I am not understanding something
here. What am I missing?????
--
Barry Fitzgerald
|
by: Nicole |
last post by:
I am creating template columns programmatically. I have read the msdn
article on this and I'm so close. Article:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchcreatingwebservercontroltemplatesprogrammatically.asp
I have narrowed down the problem comes in when the _DataBinding
handler is called and the literal text is being assigned, but I can't
figure out beyond that.
The main problem is that...
|
by: CW |
last post by:
In an earlier thread, I was asking for help on "Invalid attempt to
FieldCount when reader is closed" error when I was using a dataset rather
than a datareader to bind to a datagrid.
After playing around with it, I found out that the error was caused by
template columns. Once I remove template columns, everything worked fine.
Here are my scenarios and I would appreciate input on it.
My datagrid is bound to a orderlines table. In the...
|
by: William Gower |
last post by:
I need to develop a datagrid that uses columns from a table. In addition I
need two columns (checkboxes) that the user will use to indicate that this
record can be closed later. The checkboxed column is not a field in the
table. It is just for the purposes of the Datagrid and I do not need to
store whether it was checked or not. Do I use a Template Column for this?
| |
by: starwiz |
last post by:
I'm trying to use the DataGrid's editing with a DropDownList. I've
tried using every code sample I've seen and none of them seem to be
able to solve my problem.
When I call e.Item.FindControl("name-of-my-DropDownList"), where e is a
DataGridCommandEventArgs passed to the UpdateCommand of the DataGrid, I
get an empty DropDownList. In fact, when I call
e.Item.FindControl("name-of-a-label") in the non-editable portion of my
template, I...
|
by: Santosh |
last post by:
Dear all i want to bind data to datagrid header template i am wrtting
follwing code it is displaying data with in item template not but it is
display data in header template
<asp:DataGrid ID="datagrid" Runat="server" ShowHeader="True">
<Columns>
<asp:TemplateColumn>
<HeaderTemplate>
<asp:Label ID="Label1" Runat="server" Text='<%#
|
by: Charleees |
last post by:
Hi all,
I have a DataGrid with Template Columns.....
There are LAbels,Linkbuttons in the Single Row..
I have to set the Constant Column width for those Template Columns in
Grid...
Wat actually happens is... when the Text size is too big... the column
|
by: Brett Wesoloski |
last post by:
I am new to using template columns. I am just trying to create a data grid
with a bound column and another column with a imagebutton in it.
What I have always done in the past was to then create a datatable and bind
that to the datagrid.
Where is my code to bind the grid to the datatable.
DataTable dt = new DataTable();
dt.Columns.Add("FundDescription");
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |