Is it possible to set DataGrid's ReadOnly property to True/False at runtime?
An example:
<asp:datagrid id="dg1" runat="server" AutoGenerateCol umns="False">
<Columns>
<asp:BoundColum n DataField="id" ReadOnly="True"
HeaderText="ID" ></asp:BoundColumn >
</Columns>
<asp:datagrid > 5 2193 Is it possible to set DataGrid's ReadOnly property to True/False at runtime?
P.S. My question was not limited to <asp:BoundColum n/>, but to
<asp:TemplateCo lumn/> as well:
<asp:datagrid id="dg1" runat="server" AutoGenerateCol umns="False">
<Columns>
<ItemTemplate >
<asp:Label id="lblSum" runat="server" Text='<%#
Container.DataI tem("Sum") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTempla te>
<asp:TextBox id="txtSum" runat="server" Text='<%#
Container.DataI tem("Sum") %>'>
</asp:TextBox>
</EditItemTemplat e>
</Columns>
</asp:datagrid>
I would like to acomplish next: to show TextBoxes, only in some cells
(columns), not in all.
John Smith wrote: Is it possible to set DataGrid's ReadOnly property to True/False at runtime? An example:
<asp:datagrid id="dg1" runat="server" AutoGenerateCol umns="False"> <Columns> <asp:BoundColum n DataField="id" ReadOnly="True" HeaderText="ID" ></asp:BoundColumn > </Columns> <asp:datagrid >
Hmm. You asked about the grid's ReadOnly property, but you illustrated
it by showing a column's ReadOnly attribute. Which one did you really
mean?
Sub SetGridEditMode (RO as boolean)
dg1.ReadOnly = RO
End Sub
or
Sub SetGridColEditM ode(colidx as int32,RO as boolean)
dim col as datagridcolumn = dg1.Columns(col idx)
End Sub
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup. Hmm. You asked about the grid's ReadOnly property, but you illustrated it by showing a column's ReadOnly attribute. Which one did you really mean?
Column's ReadOnly attribute.
Sub SetGridColEditM ode(colidx as int32,RO as boolean) dim col as datagridcolumn = dg1.Columns(col idx) End Sub
Column doesn't have ReadOnly attribute/property?
John Smith wrote: Is it possible to set DataGrid's ReadOnly property to True/False at runtime? P.S. My question was not limited to <asp:BoundColum n/>, but to <asp:TemplateCo lumn/> as well:
My previous answer applies.
<snip> I would like to acomplish next: to show TextBoxes, only in some cells (columns), not in all.
If I understand the question correctly, you will need to use templates. http://msdn.microsoft.com/msdnmag/issues/02/01/cutting/ http://msdn.microsoft.com/library/en...asp?frame=true
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
John Smith wrote: Hmm. You asked about the grid's ReadOnly property, but you illustrated it by showing a column's ReadOnly attribute. Which one did you really mean?
Column's ReadOnly attribute.
Sub SetGridColEditM ode(colidx as int32,RO as boolean) dim col as datagridcolumn = dg1.Columns(col idx) End Sub
Column doesn't have ReadOnly attribute/property?
You're right. I also missed a step:
dim col as boundcolumn = ctype(dg1.Colum ns(colidx), _
boundcolumn)
col.readonly = RO
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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: Richard Ryerson |
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):
1. DataGrid (dgContracts) - Lists current contracts.
1.1. ButtonColumn (CommandName SelectContract) - Selects a contract to
|
by: Steve |
last post by:
I am fairly new to VB.NET, and I am rewriting an application I wrote a while
back, also in VB.NET. I aplied some new things I learned. Anyway, here is my
problem.......
I have a custom DataGrid with a buttonRow that does a delete function for
me. Microsoft support helped me back then to get this done.
Here is part of the code that creates the dataGrid:
Dim ButtonColStyle As DataGridButtonColumn
|
by: pmcguire |
last post by:
I have a DataGrid control for which I have also created several new extended
DataGridColumnStyles. They behave pretty nicely, but I can't figure out how
to implement Selected Item formatting for them.
In a plain vanilla DataGrid, when you click on the RowHeader, the
appropriate row changes colors. I ASSUME this should be done in the Paint
(or PaintText) override of the DataGridColumnStyle in question. My problem
is that I don't know...
|
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: 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: 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: 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
| |