GridView - changing the header text programmatically not working the 1st time page is rendered

 My users will click on a calender control date, this will load a gridview listing classes for the day. I want the header text to display the date, but it wont display the date after the 1st click. It does display it after the second click. I am doing this in the rowDatabound event. I know that its probably not showing because the control isnt rendered completely at that time. How can I get it to show the first time? THanks in advance

    Private Sub gvSchedule_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvSchedule.RowDataBound

        If e.Row.RowType = DataControlRowType.DataRow Then
            If e.Row.RowType = DataControlRowType.DataRow Then
                ' reference the Delete LinkButton
                Dim db As LinkButton = CType(e.Row.Cells(0).Controls(0), LinkButton)
                db.Attributes.Add("onclick", "return confirm_delete();")
            End If
        End If

        Me.gvSchedule.Columns.Item(0).HeaderText = Me.Calendar1.SelectedDate

    End Sub

 

0
bertino12
6/26/2007 7:46:50 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

1 Replies
504 Views

Similar Articles

[PageSpeed] 45

 

try using

OnDataBinding

instead of

OnDataBound

 events

 


Do not forget to mark as answer all message who help you.

Don't forget to check if you can answer some of our question to.
0
Wookie
6/26/2007 8:41:31 PM
Reply:

Similar Artilces:

Error Rendering Control ... using the Title property of Page requires a header control on the page. (e.g. <head runat="server" />
Hi All,I have a custom control that inherits from CompositeControl and implements INamingContainer and IPostBackDataHandler.  The control is an intelligent BreadCrumb generator for use on a MasterPage.  It generates LinkButtons for the crumbs based on Server.Transfer() calls to and from ClientPages.Instead of the control rendering as the value of its Text property on the aspx page (which it did when I first started it), I get the following error ***************** Error Rendering Control - ControlNameAn unhandled exception has occurred.Using the Title property of the Page ...

Trying to use the FAQ " Sorting and paging in the GridView control when not using data source controls "Sorting and paging in the GridView control when not using..."
and I am not getting the results I had hoped for.  I keep getting a "Compiler Error Message: CS0123: No overload for 'AdhocJobGridView_PageIndexChanged' matches delegate 'System.EventHandler'".   Here is my event handling... protected void AdhocJobGridView_PageIndexChanged(object sender, GridViewPageEventArgs e){ try { AdhocJobGridView.DataSource = wsBaseInfoArray; AdhocJobGridView.PageIndex = e.NewPageIndex; AdhocJobGridView.DataBind(); }catch (Exception ex) {throw ex; }   Here is my aspx... <asp:GridView ID="AdhocJobGridView...

Paging only works with very simple Gridview controls?
I have the following:<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:wapConnectionString %>"SelectCommand="SELECT [AD TYPE], [DATE OF BIRTH], FILE2, [FIRST NAME], [LAST NAME], [MALE OR FEMALE], Overseas, PHOTO, RACE, [RELIGION 1], STATE, Suspend FROM members WHERE (STATE = @State OR STATE = NULL) AND ([MALE OR FEMALE] = @Gender) AND (RACE = @race) AND ([RELIGION 1] = @religion) AND (Suspend = 0) AND ([AD TYPE] = @AdType) AND (PHOTO = @Photo) AND (Overseas = @OverSeas)">           ...

inserting record present in one gridview in one page into gridview in other page
hi,i have two .aspx pages.one page(watch.aspx) have gridview with fields  given below.the fourth column is a hyperlink column                                                        watch.aspx                      ...

GridView: image is added under the header text instead of in front of it (same level as the header text)
 Hi,I have a boundfield in my gridview like this:                                        <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name">                                 &n...

problem setting header text programmatically for gridview
Hi I have a gridview with custom bidirectional sortin I am trying to set up the gridview so that the header contains a little arrow image indicating the direction of the sort. Here is my code:Dim dcfColl As DataControlFieldCollection = GridView1.Columns         Dim dcf As DataControlField         For Each dcf In dcfColl            '    'sorting occurs before bnding            Dim s As String = dc...

How to programmatically add user control to the middle of text inside Literal text control ? Pls help...
Greetings fellow programmers,I greatly appreciate all the help I can get. Here is the problem.I have a function that pulls content from the database and put the content into a literal control. Somewhere in that content, I need to insert a user control (bla.ascx). Ideally, I want to use string.replace to find the location where I want to insert the user control. But I can't... there is no such option on the literal control methods and properties.Do I have to overwrite render method? I'd normally use loadcontrol and add it to the placeholder control, but in this case, I can't dynamically ...

How to control the text-size effects on the Master page presentation
I have built a web site using ASP,net 2.0 with a master page and many content pages.Recently a manager told me that when he changed to a big text size, the Title and subtitlelines mixed up.   I know we probably can not design a web site to fit all kind of text sizes. Are there some guidelines to effectively use the % and px on a master page, so that the contentpages, or the navigation bars, or subtitle label will not mix with the Title label?   Below is a summary of the layout design for my master page. Will appreciate your help in improving the layout coding.  ...

Page rendering of Gridview control different between IE and Mozilla Firefox.
I'm novice so must be missing something. Have page developed with VWD setting of XHTML 1.0 Transitional Doctype. The Gridview control shifts way to the right on the page and stacks under another control on the page when rendered with Mozilla Firefox. It was tested OK. Renders OK with IE7.  It appears that the "Left: 193" parm shown under "Style=" below is interpreted differently between the two browsers for some reason. I'm a newbie at this so I've missed something.  Can someone shed some light on this? Thanks <asp:GridView ID="...

how to do paging in gridview programmatically using vb.net 2.0
hi all, i'm using vb.net 2.0. i have a grid view in my page. i bind the data in gridview programmatically using business layer and data access layer. now i have to do the paging programmatically. i want the grid view to show 3 page at a time and also want to have "previous" and "next" link instead of usual numbers. when i click next it have to show next 3 data's from the sql server 05 database. any one who know abt this please please send me the code.. thanks swapnaThanks SwapnaPlease click "mark as answer" if this post helped you.  Hi,In Gri...

How can display Header text of GridView control as normal font?
I find the Header text of GridView control always display Bold style, how can I remove the property? many thanks!SuperCool Multiple ZIP - A utility to unzip multiple files and work with multiple zip filesSuperCool Random Number Generator  hi friend.,this can be done with UseAccessibleHeader="False"  property of GridView Control.hope this helps./. Thanx, [KaushaL] || BloG || Profile || Microsoft MVP"I would love to change the world, but they won’t give me the source code"Don't forget to click "Mark as Answer" on the post that helped you.This ...

How to add Header text, paging and sorting in Gridview with Custom DataSource?
I am using a Gridview to display the data from one of my tabels of the database. I am aware about various properties of the Gridview for HeaderText, Paging and Sorting however the problem is that I am not using the DataSet or DataTable as a DataSource of the GridView. I need to use a Collection of objects of my Data Access Layer to populate the Gridview with appropriate data.I am able to populate the Gridview however in the header text of the GridView, it is displaying the default column names of the database table to display. e.g. For the ID column, it display ClientId which is a column nam...

Control of the page and the controls on a page
I am building a web app that has some pages that are public and some that are only available based on subscription. Could someone explain the best way (infrastructure wise) how to control whether a server control is visible or enabledand how to control whether a page is viewable or not based on the user and whether or not the user is logged in (or not). If a user is not logged in I would like some controls to be visible but disabled. I also have to control the URL's in case a person learnsthe URL and tries to type it in. My question is more towards how to do this database wise. I am u...

paging in gridview works on first page only
Hi, I have the following gridview:<asp:GridView ID="showCompanies" runat="server" AllowPaging="true" PageSize="15" DataSourceID="sql_showCompanies" DataKeyNames="company_id,country_id" onselectedindexchanged="showCompanies_SelectedIndexChanged"> <Columns><asp:CommandField ShowSelectButton="True" ButtonType="Image" SelectImageUrl="~/pics/edit.jpg" ItemStyle-Width="40px" SelectText="Edit company" ItemStyle-HorizontalAlign="Center" />...

FireFox with Update Panel around Tab control and gridview; paging does not work
Hi, I have a web page that has an a Atlas Tab control with a gridview in one panel.  I have this contained in an Update panel.  In IE the gridview paging works great.  In Firefox I get a blank page when I change pages. Any one experienced a problem like this? It seems to work if I put the Update Panel inside the Tab Panel with the gridview in the update panel.  I will have to rearrange all of my pages configured like this. For now, solution is to put gridview in Update Panel then Update Panel in Tab Panel; until I hit spot where I can't do this.&nbs...

Web resources about - GridView - changing the header text programmatically not working the 1st time page is rendered - asp.net.presentation-controls

[...] How to Programmatically Administer Off-Facebook Pages with the Open Graph API - Inside Facebook ...
With the Open Graph protocol that Facebook announced at last week’s f8 conference, any URL can now be treated just like a Facebook Page. After ...

Well, This Is Different Time Inc. Now Selling Print Ads Programmatically
Machines are now selling some print ads at Time Inc. The nation's largest magazine publisher owner of People, Time, Sports Illustrated and InStyle ...

Now Marketers Can Buy Sponsored Content Programmatically
Publishers' branded content is going programmatic. Today, Sharethrough and AppNexus are rolling out real-time bidding for Sharethrough's news ...

Wesabe makes Financial Data available programmatically
Wesabe has just done what I've been trying to convince banks to do for years. They're making financial data available via a simple POX (Plain ...

IPG Begins Buying Local Broadcast Programmatically: Can Target, Retarget Viewers In Near Real-Time
In what likely is the most significant development yet to bring programmatic media-buying to local broadcast television, Interpublic's Mediabrands ...

Google Launches Cloud SQL API To Allow Developers To Manage Their Databases Programmatically
... to use Google’s admin interface. Today, however, Google is launching the Cloud SQL API . This new REST API will allow developers to programmatically ...

Are Programmatically Purchased Native Ads Native Enough?
It seems everyone and their mothers are pushing native ad units and tools to support them. Facebook, Twitter, Yahoo and most recently AOL all ...

Most Major U.S. Publishers Now Sell Ads Programmatically
Most major online publishers in the U.S. now sell at least some of their ad space using automated "programmatic" technology, according to new ...

TV Ads Could Soon Be Sold Programmatically, Magna’s Todd Gordon
The key efficiency new-wave digital media sales holds over TV is clear – super-targeting through addressable, automated and programmatic buying ...

How To Use Facebook's New Power Editor For Ads
Here's a guide to the power editor in Facebook's ad manager.

Resources last updated: 11/22/2015 1:37:40 PM