473,795 Members | 3,440 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Removing columns from Gridview(2.0) databinding on templatefileds dont work?

Hi,

I have a gridview (2.0), in the page load I remove a couple of columns from
the gridview which I dont need.
(All the columns are databound)
This works fine. But after a postback all the templatefields are not bind
anymore.
Only the boundfields are still bound.
Why? and what can I do about this?
Many thanks,

Page_Load:

If Not IsPostBack Then

'Loop to remove the extra columns we dont need:

end if
Apr 2 '06 #1
7 1375
If you don't need them, remove from the design. This may actually help
resolve your main issue.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Maarten" <Pa****@mayo.co m> wrote in message
news:uH******** ******@tk2msftn gp13.phx.gbl...
Hi,

I have a gridview (2.0), in the page load I remove a couple of columns
from the gridview which I dont need.
(All the columns are databound)
This works fine. But after a postback all the templatefields are not bind
anymore.
Only the boundfields are still bound.
Why? and what can I do about this?
Many thanks,

Page_Load:

If Not IsPostBack Then

'Loop to remove the extra columns we dont need:

end if

Apr 2 '06 #2
Hi Christopher,

I understand that, but that's no option.
I only know which one to remove at run-time, due to user selection.
And not at design-time!


"Christophe r Reed" <ca****@nospam. nospam> wrote in message
news:eV******** ******@TK2MSFTN GP09.phx.gbl...
If you don't need them, remove from the design. This may actually help
resolve your main issue.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Maarten" <Pa****@mayo.co m> wrote in message
news:uH******** ******@tk2msftn gp13.phx.gbl...
Hi,

I have a gridview (2.0), in the page load I remove a couple of columns
from the gridview which I dont need.
(All the columns are databound)
This works fine. But after a postback all the templatefields are not bind
anymore.
Only the boundfields are still bound.
Why? and what can I do about this?
Many thanks,

Page_Load:

If Not IsPostBack Then

'Loop to remove the extra columns we dont need:

end if


Apr 3 '06 #3
Then, are you building your GridView in the Page_Load? If so, make sure the
call to the DataBind method is not inside the If (!IsPostBack) clause.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Pipo" <Pa****@Mayo.co m> wrote in message
news:eu******** ******@TK2MSFTN GP12.phx.gbl...
Hi Christopher,

I understand that, but that's no option.
I only know which one to remove at run-time, due to user selection.
And not at design-time!


"Christophe r Reed" <ca****@nospam. nospam> wrote in message
news:eV******** ******@TK2MSFTN GP09.phx.gbl...
If you don't need them, remove from the design. This may actually help
resolve your main issue.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Maarten" <Pa****@mayo.co m> wrote in message
news:uH******** ******@tk2msftn gp13.phx.gbl...
Hi,

I have a gridview (2.0), in the page load I remove a couple of columns
from the gridview which I dont need.
(All the columns are databound)
This works fine. But after a postback all the templatefields are not
bind anymore.
Only the boundfields are still bound.
Why? and what can I do about this?
Many thanks,

Page_Load:

If Not IsPostBack Then

'Loop to remove the extra columns we dont need:

end if



Apr 4 '06 #4
No, I am not doing that. It's already databound in design time(see OP)
It is bound through a ObjectDataSourc es.

"Christophe r Reed" <ca****@nospam. nospam> wrote in message
news:OF******** ******@TK2MSFTN GP09.phx.gbl...
Then, are you building your GridView in the Page_Load? If so, make sure
the call to the DataBind method is not inside the If (!IsPostBack) clause.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Pipo" <Pa****@Mayo.co m> wrote in message
news:eu******** ******@TK2MSFTN GP12.phx.gbl...
Hi Christopher,

I understand that, but that's no option.
I only know which one to remove at run-time, due to user selection.
And not at design-time!


"Christophe r Reed" <ca****@nospam. nospam> wrote in message
news:eV******** ******@TK2MSFTN GP09.phx.gbl...
If you don't need them, remove from the design. This may actually help
resolve your main issue.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Maarten" <Pa****@mayo.co m> wrote in message
news:uH******** ******@tk2msftn gp13.phx.gbl...
Hi,

I have a gridview (2.0), in the page load I remove a couple of columns
from the gridview which I dont need.
(All the columns are databound)
This works fine. But after a postback all the templatefields are not
bind anymore.
Only the boundfields are still bound.
Why? and what can I do about this?
Many thanks,

Page_Load:

If Not IsPostBack Then

'Loop to remove the extra columns we dont need:

end if



Apr 4 '06 #5
Then, anytime you make a change to the GridView, you have to DataBind it
again.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Pipo" <Pa****@Mayo.co m> wrote in message
news:em******** ******@TK2MSFTN GP14.phx.gbl...
No, I am not doing that. It's already databound in design time(see OP)
It is bound through a ObjectDataSourc es.

"Christophe r Reed" <ca****@nospam. nospam> wrote in message
news:OF******** ******@TK2MSFTN GP09.phx.gbl...
Then, are you building your GridView in the Page_Load? If so, make sure
the call to the DataBind method is not inside the If (!IsPostBack)
clause.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Pipo" <Pa****@Mayo.co m> wrote in message
news:eu******** ******@TK2MSFTN GP12.phx.gbl...
Hi Christopher,

I understand that, but that's no option.
I only know which one to remove at run-time, due to user selection.
And not at design-time!


"Christophe r Reed" <ca****@nospam. nospam> wrote in message
news:eV******** ******@TK2MSFTN GP09.phx.gbl...
If you don't need them, remove from the design. This may actually help
resolve your main issue.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Maarten" <Pa****@mayo.co m> wrote in message
news:uH******** ******@tk2msftn gp13.phx.gbl...
> Hi,
>
> I have a gridview (2.0), in the page load I remove a couple of columns
> from the gridview which I dont need.
> (All the columns are databound)
> This works fine. But after a postback all the templatefields are not
> bind anymore.
> Only the boundfields are still bound.
> Why? and what can I do about this?
>
>
> Many thanks,
>
> Page_Load:
>
> If Not IsPostBack Then
>
> 'Loop to remove the extra columns we dont need:
>
> end if
>



Apr 4 '06 #6
I will try that, thank you!
"Christophe r Reed" <ca****@nospam. nospam> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
Then, anytime you make a change to the GridView, you have to DataBind it
again.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Pipo" <Pa****@Mayo.co m> wrote in message
news:em******** ******@TK2MSFTN GP14.phx.gbl...
No, I am not doing that. It's already databound in design time(see OP)
It is bound through a ObjectDataSourc es.

"Christophe r Reed" <ca****@nospam. nospam> wrote in message
news:OF******** ******@TK2MSFTN GP09.phx.gbl...
Then, are you building your GridView in the Page_Load? If so, make sure
the call to the DataBind method is not inside the If (!IsPostBack)
clause.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Pipo" <Pa****@Mayo.co m> wrote in message
news:eu******** ******@TK2MSFTN GP12.phx.gbl...
Hi Christopher,

I understand that, but that's no option.
I only know which one to remove at run-time, due to user selection.
And not at design-time!


"Christophe r Reed" <ca****@nospam. nospam> wrote in message
news:eV******** ******@TK2MSFTN GP09.phx.gbl...
> If you don't need them, remove from the design. This may actually
> help resolve your main issue.
> --
> Christopher A. Reed
> "The oxen are slow, but the earth is patient."
>
> "Maarten" <Pa****@mayo.co m> wrote in message
> news:uH******** ******@tk2msftn gp13.phx.gbl...
>> Hi,
>>
>> I have a gridview (2.0), in the page load I remove a couple of
>> columns from the gridview which I dont need.
>> (All the columns are databound)
>> This works fine. But after a postback all the templatefields are not
>> bind anymore.
>> Only the boundfields are still bound.
>> Why? and what can I do about this?
>>
>>
>> Many thanks,
>>
>> Page_Load:
>>
>> If Not IsPostBack Then
>>
>> 'Loop to remove the extra columns we dont need:
>>
>> end if
>>
>
>



Apr 5 '06 #7
Nope, not working either

"Pipo" <Pa****@Mayo.co m> wrote in message
news:uy******** *****@TK2MSFTNG P05.phx.gbl...
I will try that, thank you!
"Christophe r Reed" <ca****@nospam. nospam> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
Then, anytime you make a change to the GridView, you have to DataBind it
again.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Pipo" <Pa****@Mayo.co m> wrote in message
news:em******** ******@TK2MSFTN GP14.phx.gbl...
No, I am not doing that. It's already databound in design time(see OP)
It is bound through a ObjectDataSourc es.

"Christophe r Reed" <ca****@nospam. nospam> wrote in message
news:OF******** ******@TK2MSFTN GP09.phx.gbl...
Then, are you building your GridView in the Page_Load? If so, make
sure the call to the DataBind method is not inside the If (!IsPostBack)
clause.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Pipo" <Pa****@Mayo.co m> wrote in message
news:eu******** ******@TK2MSFTN GP12.phx.gbl...
> Hi Christopher,
>
> I understand that, but that's no option.
> I only know which one to remove at run-time, due to user selection.
> And not at design-time!
>
>
>
>
> "Christophe r Reed" <ca****@nospam. nospam> wrote in message
> news:eV******** ******@TK2MSFTN GP09.phx.gbl...
>> If you don't need them, remove from the design. This may actually
>> help resolve your main issue.
>> --
>> Christopher A. Reed
>> "The oxen are slow, but the earth is patient."
>>
>> "Maarten" <Pa****@mayo.co m> wrote in message
>> news:uH******** ******@tk2msftn gp13.phx.gbl...
>>> Hi,
>>>
>>> I have a gridview (2.0), in the page load I remove a couple of
>>> columns from the gridview which I dont need.
>>> (All the columns are databound)
>>> This works fine. But after a postback all the templatefields are not
>>> bind anymore.
>>> Only the boundfields are still bound.
>>> Why? and what can I do about this?
>>>
>>>
>>> Many thanks,
>>>
>>> Page_Load:
>>>
>>> If Not IsPostBack Then
>>>
>>> 'Loop to remove the extra columns we dont need:
>>>
>>> end if
>>>
>>
>>
>
>



Apr 6 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1103
by: prashant | last post by:
Hi, I have set up transactional replication with queued updation. But I want to make sure that identical columns dont get replicated. For that, I wanted to make all identical columns in all the tables as 'NOT_FOR_REPLICATION'. But I have got around 450 objects. Is there any way to make this (i.e., setting identical column property as 'NOT_FOR_REPLICSTION' for all objects) using SQL scripts. If so can anyone could send me that please..
9
24814
by: J055 | last post by:
Hi I have a very simple configuration of the GridView with paging and sorting. When I do a postback the DataBinding event fires twice - in both the ProcessPostData and PreRender stages of the page life cycle. In this example the event fires twice when a) GridView EnableViewState=False and any image type control in the <columns/> element. When either EnableViewState is set to true or the image button is removed, the event fires once....
1
2354
by: SMichal | last post by:
Is there some posibility how to bind a nested classes to GridView ? class BLZ { public string name; public string text; } class Konto {
0
1750
by: satchi | last post by:
Hi, I'm having trouble figuring out how to conditionally bind a GridView to an sqldatasource depending on the user's input to a TextBox and selecting the field to search by, in a DropDownList control. Basically I have a textbox where the user inputs a keyword. Then the user selects from a dropdownlist "pid" or "name" to search. Then the user clicks on a button to fill the gridview. So, if the user selects "pid", the sql statement that...
12
5947
by: tarscher | last post by:
Hi all, A simple problem that seems hard to solve... I have a gridview with a date row. <ItemTemplate> <asp:Label ID="Label2" runat="server" Text='<%# Bind("time") %>'></asp:Label> </ItemTemplate>
0
913
by: new2the | last post by:
i am using gridview to show data from a mysql database using a adapter and the fill command but when i run it the last row is missing the last data ( a string) all other rows is working fine.
1
1108
by: aj123 | last post by:
Hello ; I added grid view in my web project and added buttun feild and covert it to template feild and every thing works ok protected void Grid1_Command(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e) { String z = (String)e.CommandArgument; int indexGrid = Convert.ToInt16(z);
1
1916
by: Jay Pondy | last post by:
Given the following List(of Position) objects for an ObjectDataSource Position Description EmployeeA FirstName LastName EmployeeB FirstName LastName
17
290
by: ata | last post by:
Hi folks, Consider a gridview that's being bound to a ObjectDataSource that uses an adapter to handle data access logic. 1. How am I supposed to have a RowIndex column *without* modifying the Entity class? 2. How am I supposed to assign a given TAG object to each row? Any help would be highly appreciated,
1
5175
by: Mel | last post by:
I have a GridView that is bound to a DataTable. I decided to allow the user to change the column data right in the ItemTemplate. Then user won't need to click Edit to change the values and then click Update to save them because for this application the user will need to edit the data in every row so I thought the ItemTemplate would be a better solution. However, when I place the controls in my ItemTemplate my Validators are not being...
0
9519
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,...
0
10437
Oralloy
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...
0
10214
jinu1996
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...
1
10164
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,...
0
6780
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();...
0
5437
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...
1
4113
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
2
3723
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.