Hi,
I'm unable to access values in my Datagrid. Datagrid thinks it hase only 1
Cell. So here it is:
The Datagrid is binded in PageLoad, AutoGenerateCol umns is false, Columns
are added on PageLoad like this:
BoundColumn Bound_Column = new BoundColumn();
Bound_Column.Da taField = name; ( + HeaderText,
SortExpression, Visible)
DataGrid1.Colum ns.Add(Bound_Co lumn);
DataGrid has all values. Then user edits one Row and clicks on 'Update'.
Eventhandler for Update is called. Now here is my real problem, i could not
access any row. Datagrid tells me that it as 15 Items (Page), but only 1
Cell (Edit Cell i think). I tried to access datarow via:
for (int i = 1; i < 15; i++) // We have 15 Rows... E. g. (as
e.Utem.Cells.Co unt is 1)
String columnContent = ((TextBox)e.Ite m.Cells[i].Controls[0]).Text;
This leads to an Out of Range Exceptions, as Datagrid has only How can i
access the value of the current row?
Thanks for your help,
_MC_ 4 2109
On Apr 3, 1:39 pm, "_MC_" <mc@localhostwr ote:
Hi,
I'm unable to access values in my Datagrid. Datagrid thinks it hase only 1
Cell. So here it is:
The Datagrid is binded in PageLoad, AutoGenerateCol umns is false, Columns
are added on PageLoad like this:
BoundColumn Bound_Column = new BoundColumn();
Bound_Column.Da taField = name; ( + HeaderText,
SortExpression, Visible)
DataGrid1.Colum ns.Add(Bound_Co lumn);
DataGrid has all values. Then user edits one Row and clicks on 'Update'.
Eventhandler for Update is called. Now here is my real problem, i could not
access any row. Datagrid tells me that it as 15 Items (Page), but only 1
Cell (Edit Cell i think). I tried to access datarow via:
for (int i = 1; i < 15; i++) // We have 15 Rows... E. g. (as
e.Utem.Cells.Co unt is 1)
String columnContent = ((TextBox)e.Ite m.Cells[i].Controls[0]).Text;
This leads to an Out of Range Exceptions, as Datagrid has only How can i
access the value of the current row?
Thanks for your help,
_MC_
Are your cells editable (i.e. not set to ReadOnly)?
On Apr 3, 10:39 am, "_MC_" <mc@localhostwr ote:
Hi,
I'm unable to access values in my Datagrid. Datagrid thinks it hase only 1
Cell. So here it is:
The Datagrid is binded in PageLoad, AutoGenerateCol umns is false, Columns
are added on PageLoad like this:
BoundColumn Bound_Column = new BoundColumn();
Bound_Column.Da taField = name; ( + HeaderText,
SortExpression, Visible)
DataGrid1.Colum ns.Add(Bound_Co lumn);
DataGrid has all values. Then user edits one Row and clicks on 'Update'.
Eventhandler for Update is called. Now here is my real problem, i could not
access any row. Datagrid tells me that it as 15 Items (Page), but only 1
Cell (Edit Cell i think). I tried to access datarow via:
for (int i = 1; i < 15; i++) // We have 15 Rows... E. g. (as
e.Utem.Cells.Co unt is 1)
String columnContent = ((TextBox)e.Ite m.Cells[i].Controls[0]).Text;
This leads to an Out of Range Exceptions, as Datagrid has only How can i
access the value of the current row?
Thanks for your help,
_MC_
are you using a master page?
if so are you giving your master page an id?
i had a similar problem where i was losing the values of datakeys
within a gridview (on top of another weird treeview error)
and after many attempts at fixing it, i don't know why but i removed
the id i was assigning the master page and it worked. i placed the id
once again just to make sure and had the same error.
don't know what's causing it really but at least that solved my
problems
hope it helps
Hi,
bdp: "Are your cells editable (i.e. not set to ReadOnly)?"
they are all editable. Even if they are not editable I should have
access on it, or?
chanko: we're currently using an master page, but what do you mean with
"if so are you giving your master page an id?"?
Thanks,
_MC_
Hi,
some debug hours later...
User Html Code only contains javascript postback for Cell 0 (the static edit
Cell) on edit command, so we never get any information about the user
changed. http://msdn2.microsoft.com/en-us/library/aa478966.aspx wrote:
"If you do find yourself in one of these scenarios, be aware that your
dynamic controls do not preserve themselves when the page is submitted."
That seems to be my problem, nevertheless there must be a chance to access
the changed values, musn't it? We only need those values, if datagrid does
not preserve values is irrelevant. We simple had to access those values.
It's no possible that all other column values are lost.
Note: If i manually add the columns in designer mode all here created
columns are present on update. However, we need to create the columns on
runtime as we have e. g. an drop down menue for table, etc so it's not
possible in my eyes to to this static.
Thanks for your help!
_MC_
"_MC_" <mc@localhostsc hrieb im Newsbeitrag
news:eh******** ********@TK2MSF TNGP05.phx.gbl. ..
Hi,
bdp: "Are your cells editable (i.e. not set to ReadOnly)?"
they are all editable. Even if they are not editable I should have access
on it, or?
chanko: we're currently using an master page, but what do you mean with
"if so are you giving your master page an id?"?
Thanks,
_MC_
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: San Diego Guy |
last post by:
Hi all!
I have Datagrid.
Within that datagrid I have a drop down list that I set up some values in (a
"collection")
I set up an edit command column on the datagrid and wrote simple code to get
me in to edit mode:
sub dgEdit(ByVal s As Object, ByVal e As DataGridCommandEventArgs)
dgStatus.EditItemIndex = e.Item.ItemIndex
bindData() 'This is just a sub I wrote to re-bind the data
|
by: Maziar Aflatoun |
last post by:
Hi everyone,
Here is my problem. I have a datagrid that I binds to a table with the
following fields.
PID
FirstName
LastName
In my datagrid I display FirstName and LastName along with a edit option
|
by: Rick |
last post by:
Hello all, I hope all is well with you.
I am having a seriously difficult time with this problem. Allow me to
set
up the problem.
I have a System.Web.UI.Page with the following controls (watch the
layout,
some have child controls):
|
by: Harry Devine |
last post by:
I have a DataGrid that is configured to use the Edit/Update/Cancel concept
correctly. My grid shows values from 5 database fields. I only need to
update that last 4 fields. The last field is a Yes/No value in Access.
Using the OleDbCommand, if I do not consider the Yes/No field, the
ExecuteNonQuery command, using my UPDATE SQL statement, updates the record
correctly. However, if I put the Yes/No field into the mix, ExecuteNonQuery...
|
by: Anna |
last post by:
I have a simple DataGrid that displays a list of characteristics and
allows you to edit a description for each characteristic. The query
that feeds this involves a join, as the characteristics and their
descriptions are in separate tables. The DataKeyField of the DataGrid
is set to the description ID, but I also need to be able to access the
characteristic ID in my update query (without displaying it in the
DataGrid). I haven't had much...
| |
by: jimb |
last post by:
I can get the dropdownlist into the datagrid, and I can populate it, but I
can't read it.
Anybody have a working example of a dropdownlist in an editable grid?
Thanks.
--
..
http://sf-f.org, weblog and search engine for fans and writers of
|
by: Ron L |
last post by:
I have a dataset whose source is a SQL 2k stored procedure that I am trying
to display in a datagrid. This datasource has 4 columns that I am
interested in here, a text column and 3 value columns corresponding to
permissions to certain data classes. I want to put the permission values in
combo boxes in the grid and instead of displaying the numeric values, have
the combo box display a string that corresponds to the numeric value (i.e.
No...
|
by: cindy |
last post by:
I have a dynamic datagrid. I have custom classes for the controls
public class CreateEditItemTemplateDDL : ITemplate {
DataTable dtBind;
string strddlName;
string strSelectedID;
string strDataValueField;
string strDataTextField;
public CreateEditItemTemplateDDL(string DDLName,string DataValueField,string
|
by: rn5a |
last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB
table. Users can modify the records using this DataGrid for which I am
using EditCommandColumn in the DataGrid. This is the code:
<script runat="server">
Dim sqlConn As New SqlConnection(".....")
Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)
If Not (Page.IsPostBack) Then
FillDataGrid()
|
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: 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: 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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |