I'm looking into this peace of code:
protected void DropDown_Select edIndexChanged( object sender, EventArgs e)
{
DropDownList list = (DropDownList)s ender;
TableCell cell = list.Parent as TableCell;
DataGridItem item = cell.Parent as DataGridItem;
int index = item.ItemIndex;
string content = item.Cells[0].Text;
Response.Write(
String.Format(" Row {0} contains {1}", index, content)
);
}
can I do this:
item.Cells[0].Text = "Some text...";
I don't want only to change value in the grid (displayed value), but also in
the underlaying DataSource (which is of XML file type). 3 2133
This is too early in the page processing life cycle to change the cell
text. You'll have to change it in the Page.PreRender or later in the
page life cycle.
If you change the cell text, or pretty much any object in the datagrid,
at this point it is still "vulnerable " to changes being made to it by
the asp.net framework during round trip processing.
Curtis
John Smith wrote: I'm looking into this peace of code:
protected void DropDown_Select edIndexChanged( object sender, EventArgs e) { DropDownList list = (DropDownList)s ender;
TableCell cell = list.Parent as TableCell; DataGridItem item = cell.Parent as DataGridItem;
int index = item.ItemIndex; string content = item.Cells[0].Text;
Response.Write( String.Format(" Row {0} contains {1}", index, content) );
}
can I do this:
item.Cells[0].Text = "Some text...";
I don't want only to change value in the grid (displayed value), but also in the underlaying DataSource (which is of XML file type).
You can always rebind the grid to a different datasource.
"John Smith" <jo********@mic rosoft.com> wrote in message
news:qR******** ************@ne ws.siol.net... I'm looking into this peace of code:
protected void DropDown_Select edIndexChanged( object sender, EventArgs e) { DropDownList list = (DropDownList)s ender;
TableCell cell = list.Parent as TableCell; DataGridItem item = cell.Parent as DataGridItem;
int index = item.ItemIndex; string content = item.Cells[0].Text;
Response.Write( String.Format(" Row {0} contains {1}", index, content) );
}
can I do this:
item.Cells[0].Text = "Some text...";
I don't want only to change value in the grid (displayed value), but also in the underlaying DataSource (which is of XML file type).
Will this line of the code:
item.Cells[0].Text = "Some text...";
change only DataGrid visual value or it will also change value in the
DataSource? How can I change value in DataSource?
"Curtis" <cu**********@h otmail.com> wrote in message
news:11******** **************@ y43g2000cwc.goo glegroups.com.. . This is too early in the page processing life cycle to change the cell text. You'll have to change it in the Page.PreRender or later in the page life cycle.
If you change the cell text, or pretty much any object in the datagrid, at this point it is still "vulnerable " to changes being made to it by the asp.net framework during round trip processing.
Curtis
John Smith wrote: I'm looking into this peace of code:
protected void DropDown_Select edIndexChanged( object sender, EventArgs e) { DropDownList list = (DropDownList)s ender;
TableCell cell = list.Parent as TableCell; DataGridItem item = cell.Parent as DataGridItem;
int index = item.ItemIndex; string content = item.Cells[0].Text;
Response.Write( String.Format(" Row {0} contains {1}", index, content) );
}
can I do this:
item.Cells[0].Text = "Some text...";
I don't want only to change value in the grid (displayed value), but also in the underlaying DataSource (which is of XML file type). This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Amber |
last post by:
There are times when you will need to highlight or otherwise modify
the contents of a particular DataGrid row-column value based upon the
value in the column. In this example we will select the CompanyName,
ContactName, and ContactTitle columns from the Customers table in the
Northwind database. Whenever the value of ContactTitle equals "Owner"
we will change the font color to red.
We can do this by using an ItemTemplate where we have...
|
by: Dan Hartshorn |
last post by:
VS.NET 2003, C#, Windows Server 2003. I have a datagrid and I want the
last column to be either an EditCommandColumn or a template column,
depending on a value I have. The value changes for each row. So some
rows will have an EditCommandColumn, others just a text message in the
last column. Is this possible? I am already using the ItemDataBound
method to perform some function on each row, but I can't seem to
change the datagrid's column...
|
by: Andy Wang |
last post by:
I need change HeaderText of DataGrid in PreRender(). But it seems
doesn't work.
The code example like this:
Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs)
grdPortals.Columns(1).HeaderText = "Title"
End Sub
I can see the value changed correctly when I was in debug mode, but it
doesn't show on the page. It always the original value.
|
by: Miguel Dias Moura |
last post by:
Hello,
i know how to hide a table according to a condition:
<table runat="server" visible='<%# dataSetBibliotecas.FieldValue("Titulo",
Container) <> "" %>'...
Now I am trying to change the image file as follows:
- Show the image "yes.gif" if the value of a dynamic field is equal to
"YES";
- Show the image "no.gif" if the value of a dynamic field is equal to "NO".
|
by: Rob Kroese |
last post by:
I've got a form with a datagrid that displays a list of items, along
with several textboxes, comboboxes, etc., that display the details for
the selected item. The columns in the datagrid and the "details"
controls are both bound to fields in a dataview called dvItems. The
dataview is a subset of a datatable called dtItems, which is simply a
copy of all the data in a table called Items. The idea is to allow
the user to edit an item in...
| |
by: Michael via .NET 247 |
last post by:
I have a datagrid with the columns defined in the aspx
<columns>
<asp:TemplateColumn HeaderText="Hours" ItemStyle-Width="1%"ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:TextBox Columns="2" EnableViewState="False" ID="Hours"Runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
...
</columns>
|
by: zhuang |
last post by:
Hi,
Adding combobox to datagrid has been posted many times. I have a
datagrid which has multiple combobox columns and normal textbox
columns.
But how could I change other combo box values at the same row when user
change the value of one of the combo box.
The textbox value in the same row could be changed by modifying the
|
by: John Smith |
last post by:
Will this line of the code:
item.Cells.Text = "Some text...";
change only DataGrid visual value or it will also change value in the
DataSource? How can I change value in DataSource?
"Curtis" <curtsfakeguy@hotmail.com> wrote in message
|
by: remya1000 |
last post by:
i'm using VB.NET. and its a windows application.
in my program i need to display a table in datagrid. so i created the table using DataTable and i'm calling that dataTable to dataGrid. and its working fine...
but according to one of the field in that table i need to change the back color of that row. one of the field in that table called "Active", it will have value as True or False. so if Active =True then i need that corresponding row...
|
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: 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: 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: 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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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...
| |