Hello.
I have a gridview column item that i want to not make visible if the
bound data in that cell is less than a value in a textbox.
However, I notice at the time my code checks a function that I call
from the visible property of the gridview itemtemplate, the textbox is
always blank.
I tried setting the textbox in the prerender, but I suspect the
gridview is built much earlier in another event.. like items created.
Whats the best way to attack this?
Also, and a question I can't believe I'm asking.. what's the preferred
way to store information in a codebehind variable so that's a
available across all subs, functions and events? For example, if I
want to have something in a variable I set in the prerender, how do I
make that available in Page load sub? 3 8874
PreRender is the right place for this. At this stage the grid has already
been fully built, which is your advantage rather than a disadvantage since
no-one will intervene in the final changes you are making there.
PreRender event fires after Load, so it won't help if you set something in
PreRender. Otherwise, if you just declare a field or a property in your page
class it will be visible by all other members.
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin http://usableasp.net
"jc" <jo**@webdos.co mwrote in message
news:b3******** *************** ***********@f3g 2000hsg.googleg roups.com...
Hello.
I have a gridview column item that i want to not make visible if the
bound data in that cell is less than a value in a textbox.
However, I notice at the time my code checks a function that I call
from the visible property of the gridview itemtemplate, the textbox is
always blank.
I tried setting the textbox in the prerender, but I suspect the
gridview is built much earlier in another event.. like items created.
Whats the best way to attack this?
Also, and a question I can't believe I'm asking.. what's the preferred
way to store information in a codebehind variable so that's a
available across all subs, functions and events? For example, if I
want to have something in a variable I set in the prerender, how do I
make that available in Page load sub?
would anybody have an example of how I can loop through the grid and
change visibility of items after it's been built?
On Dec 12, 6:55 am, jc <j...@webdos.co mwrote:
would anybody have an example of how I can loop through the grid and
change visibility of items after it's been built?
Sounds like you can use a RowDataBound event handler like so (very
sketchy code, but you get the idea.)
protected void MyGridView_RowD ataBound(object s,
GridViewRowEven tArgs e)
{
// Hide the header of the leftmost column.
if (e.Row.RowType == DataControlRowT ype.Header)
{
e.Row.Cells[0].Visible = false;
}
// Hide the leftmost column of the data row.
if (e.Row.RowType == DataControlRowT ype.DataRow)
{
e.Row.Cells[0].Visible = false;
}
} This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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: wardy |
last post by:
Hi, I'm hoping someone can lend me a hand....I've got a .NET Web app
running on Windows 2000 IIS 5.0 linking to a SQL Server 2000 database.
When the database is located on the same server as the web app, the
pages render quickly - however, when I run the app with the database
on its own server, the page rendering takes anywhere from 5-8 seconds,
and when I enable tracing on the application, it appears to be the
begin prerender event that...
|
by: Francois |
last post by:
Hi,
First of all sorry for the long post but I believe it is quite an
interesting as well as advanced and complex problem.
I have a problem with the checkbox control I have in my repeater.
I am using a repeater that I bind to some data in the Page_Load method.
That page is heavy and highly dynamic and the viewstate of the repeater and
all the controls existing in that repeater are set to "False" as none of the
information in the...
|
by: Paul C. |
last post by:
Hi folks. I have a WebControl TextBox which I would like to force to select
all it's text during PreRender. My problem is that I don't know how to do
this. I already have a reference to the control by using FindControl(), but
I don't see any method or property I can use to set the selection range. I
am looking for something like SelectionStart() and SelectionLength().
The WinForms TextBox has these methods, but the Web Forms does not....
|
by: D. Shane Fowlkes |
last post by:
(ASP.NET 2 / VB)
Question - How can I write a If statement to see if a control (textbox)
actually exists on a page? Upon page_load, a certain control may or may not
be visible on the page so I need to first check to see if it actually exists
and then if it does, get the value from it. If I try to read it or check if
its "visible" if it's not on the page then of course, it'll error.
Thanks!
| |
by: Mariella Bakker |
last post by:
Hi All,
In an ASP.NET project I am trying to improve performance. As it is now there
seems to be a huge bottleneck between the end of the Page.PreRender event
and the beginning of the Page.Unload event. Using a performance analyzing
tool (AqTime 4.9) I am not able to find out what is happening between these
2 events. Can anyone shine some light on what is normally going on between
these 2 events?
Thanks in advance.
|
by: mutlyp |
last post by:
I have a PreRender event to set the width of my textbox when the Edit button is pressed on my grid here is the code:
Private Sub grdPBC_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles grdPBC.PreRender
If grdPBC.EditItemIndex > -1 Then
Dim tbx As TextBox
tbx = CType(grdPBC.Items(grdPBC.EditItemIndex).Cells(4).Controls(0), TextBox)
tbx.Width = Unit.Pixel(50)
...
|
by: wildman |
last post by:
In the Page_load my code check to see if session variable is set, if
it is, it calls some subroutines that loads some grids and binds them.
In my prerender, when the grids row is in update mode, and the key = 0
(meaning I'm inserting) I'd like to set a date field to current date.
the above logic works great in another page I have where I am not
checking for session information in the page load, but in th is code
results in the error.
|
by: =?Utf-8?B?WWFua2VlIEltcGVyaWFsaXN0IERvZw==?= |
last post by:
i'm not sure how the preRender event gets handled.
if i have a function:
protected void tbPasswordPreRender(object sender, EventArgs e)
{
tbPswd1.Attributes = tbPswd1.Text;
tbPswd2.Attributes = tbPswd2.Text;
}
and set the two text boxes Prerender event to this single function will it
fire twice?
|
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: 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: 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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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.
| |