Description='<%#DataBinder.Eval(Container.DataItem, "description")%>' I have Autogeneratecolumns set to false because I don't want it to display the data in columns, I just need to set the data to properties of my control. Anyway, it works fine when the page loads, but when I change the page, the data doesn't get populated on the other pages. If I set the Autogenerate columns = true it works on every page. How do I get around not showing the columns, but still get the data?? Please help. thanks. [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => Mark [ip] => maxmann@kc.rr.c [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 1 [islastshown] => [isfirstshown] => 1 [attachments] => [allattachments] => ) --> Description='<%#DataBinder.Eval(Container.DataItem, > "description")%>' > > I have Autogeneratecolumns set to false because I don't want it to[/quote] display[quote] > the data in columns, I just need to set the data to properties of my > control. > > Anyway, it works fine when the page loads, but when I change the page, the > data doesn't get populated on the other pages. > If I set the Autogenerate columns = true it works on every page. How do I > get around not showing the columns, but still > get the data?? Please help. > > thanks. > >[/quote] [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => Datagrid Girl [MVP] [ip] => datagridgirl@op [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 2 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> Description='<%#DataBinder.Eval(Container.DataItem, > > "description")%>' > > > > I have Autogeneratecolumns set to false because I don't want it to[/quote] > display[quote] > > the data in columns, I just need to set the data to properties of my > > control. > > > > Anyway, it works fine when the page loads, but when I change the page,[/quote][/quote] the[quote][quote] > > data doesn't get populated on the other pages. > > If I set the Autogenerate columns = true it works on every page. How do[/quote][/quote] I[quote][quote] > > get around not showing the columns, but still > > get the data?? Please help. > > > > thanks. > > > >[/quote] > >[/quote] [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => Mark [ip] => maxmann@kc.rr.c [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 3 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> Data only populated on first page - ASP.NET Data Grid Control

Data only populated on first page - ASP.NET Data Grid Control

I have a user control that I am using within a datagrid to display many instances of this control w/ paging. I'm using the DataBinder.Eval to set the properties of the control within the aspx page. ex. --> Description='<%#DataBinder.Eval(Container.DataItem , "description")%>' I have Autogeneratecolumns set to false because I don't want it to display the data in columns, I just need to set the data to properties of my control. Anyway, it works fine when the page loads, but when I change the page, the data doesn't get populated on the other pages. If I set the Autogenerate columns = ...

  1. #1

    Default Data only populated on first page

    I have a user control that I am using within a datagrid to display many
    instances of this control w/ paging.
    I'm using the DataBinder.Eval to set the properties of the control within
    the aspx page.
    ex. --> Description='<%#DataBinder.Eval(Container.DataItem ,
    "description")%>'

    I have Autogeneratecolumns set to false because I don't want it to display
    the data in columns, I just need to set the data to properties of my
    control.

    Anyway, it works fine when the page loads, but when I change the page, the
    data doesn't get populated on the other pages.
    If I set the Autogenerate columns = true it works on every page. How do I
    get around not showing the columns, but still
    get the data?? Please help.

    thanks.


    Mark Guest

  2. #2

    Default Re: Data only populated on first page

    Make sure you're re-binding the data in your page index changed event.

    Datagrid Girl
    [url]http://www.datagridgirl.com[/url]

    "Mark" <maxmannkc.rr.com> wrote in message
    news:ufzdAo%23QDHA.3144tk2msftngp13.phx.gbl...
    > I have a user control that I am using within a datagrid to display many
    > instances of this control w/ paging.
    > I'm using the DataBinder.Eval to set the properties of the control within
    > the aspx page.
    > ex. --> Description='<%#DataBinder.Eval(Container.DataItem ,
    > "description")%>'
    >
    > I have Autogeneratecolumns set to false because I don't want it to
    display
    > the data in columns, I just need to set the data to properties of my
    > control.
    >
    > Anyway, it works fine when the page loads, but when I change the page, the
    > data doesn't get populated on the other pages.
    > If I set the Autogenerate columns = true it works on every page. How do I
    > get around not showing the columns, but still
    > get the data?? Please help.
    >
    > thanks.
    >
    >

    Datagrid Girl [MVP] Guest

  3. #3

    Default Re: Data only populated on first page

    HELP ME DATAGRID GIRL!!! :)

    Yes, I am rebinding the data on that event, the same as I am when I load the
    page, except I'm also setting the current page
    index also. Here's the code:

    public void Grid_Change(Object sender, DataGridPageChangedEventArgs e)
    {
    DataTable objDT;

    // Set CurrentPageIndex to the page the user clicked.

    dgMain.CurrentPageIndex = e.NewPageIndex;

    // Put user code to initialize the page here

    objDT=objExp.GetVerifiedItems();

    dgMain.DataSource = objDT;

    dgMain.DataBind();

    }


    "Datagrid Girl [MVP]" <datagridgirloperamail.com> wrote in message
    news:uSHVWDCRDHA.3144tk2msftngp13.phx.gbl...
    > Make sure you're re-binding the data in your page index changed event.
    >
    > Datagrid Girl
    > [url]http://www.datagridgirl.com[/url]
    >
    > "Mark" <maxmannkc.rr.com> wrote in message
    > news:ufzdAo%23QDHA.3144tk2msftngp13.phx.gbl...
    > > I have a user control that I am using within a datagrid to display many
    > > instances of this control w/ paging.
    > > I'm using the DataBinder.Eval to set the properties of the control
    within
    > > the aspx page.
    > > ex. --> Description='<%#DataBinder.Eval(Container.DataItem ,
    > > "description")%>'
    > >
    > > I have Autogeneratecolumns set to false because I don't want it to
    > display
    > > the data in columns, I just need to set the data to properties of my
    > > control.
    > >
    > > Anyway, it works fine when the page loads, but when I change the page,
    the
    > > data doesn't get populated on the other pages.
    > > If I set the Autogenerate columns = true it works on every page. How do
    I
    > > get around not showing the columns, but still
    > > get the data?? Please help.
    > >
    > > thanks.
    > >
    > >
    >
    >

    Mark Guest

  4. #4

    Default Re: Data only populated on first page

    bind the data on page load also.it may solve your problem.dont check
    IsPostBack etc.

    Rajesh

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Rajesh Tiwari Guest

  5. #5

    Default Re: Data only populated on first page

    I was already doing that, but I tried NOT doing it on load and still the
    same result. This has to be a bug. It makes no sense that it would work when
    the page initially loads, but then won't work when you change pages.

    Just create a simple user control with one label on it, add a property
    (Caption) to the user control and put it in a datagrid like below. You'll
    see what I mean.

    <asp:datagrid id="dgMain" runat="server" Width="95%" Font-Names="Arial"
    Font-Size="Smaller" BorderStyle="None"
    BorderWidth="2px" GridLines="None" AllowSorting="True" CellSpacing="2"
    CellPadding="1" AllowPaging="True"
    OnPageIndexChanged="Grid_Change" PageSize="3"
    AutoGenerateColumns="false">
    <Columns>
    <asp:TemplateColumn>
    <ItemStyle Width="80px"></ItemStyle>
    <ItemTemplate>
    <uc1:testcontrol id="Testcontrol1" runat="server" Caption='<%#
    DataBinder.Eval(Container.DataItem, "screenname") %>'>
    </uc1:testcontrol><br>
    </ItemTemplate>
    </asp:TemplateColumn>
    </Columns>
    <PagerStyle BorderWidth="2px" Font-Size="X-Small" Font-Names="Arial"
    BorderColor="#404040" BorderStyle="None"
    ForeColor="#0000C0" Position="TopAndBottom" BackColor="Silver"
    Mode="NumericPages"></PagerStyle>
    </asp:datagrid>




    "Rajesh Tiwari" <rajeshdospl.com> wrote in message
    news:OUC4CeIRDHA.2128TK2MSFTNGP12.phx.gbl...
    > bind the data on page load also.it may solve your problem.dont check
    > IsPostBack etc.
    >
    > Rajesh
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    Mark Guest

  6. #6

    Default Re: Data only populated on first page

    yes i agree with you.i also feel it is a bug.but the problem is that it
    is not consistent.i have used datagrid paging almost on 15 modules and
    it did not work in one or two.the problem narrowed to the fact that the
    EventHandler that is to be called on OnPageIndexChanged is not called
    when page index is changed and it leads to all the problems.but i have
    still to discover why it happens only in few cases.i am also giving a
    sample code which is showing this problem,may be someone may find what
    is wrong with this code and clarify our doubts.

    <% page Language="C#" debug=true %>
    <% Import namespace="System.Data"%>
    <% Import namespace="System.Data.SqlClient"%>
    <script language="C#" runat=server>
    SqlConnection con;
    void Page_Load(Object sender,EventArgs e)
    {
    con=new SqlConnection("Server=rajesh;database=test;uid=sa; pwd=sa");
    if(!IsPostBack)
    BindGrid();
    }
    public void DataGrid_Page(Object s,DataGridPageChangedEventArgs p)
    {
    grd.CurrentPageIndex=p.NewPageIndex;
    BindGrid();

    }
    public void BindGrid()
    {
    SqlDataAdapter adpt=new SqlDataAdapter("select * from author",con);
    DataSet dt=new DataSet();
    adpt.Fill(dt,"abcd");
    grd.DataSource=dt.Tables["abcd"].DefaultView;
    grd.DataBind();
    }
    </script>
    <html>
    <body>
    <form id=frm1 runat=server>
    <asp:datagrid id=grd AllowPaging="True" PageSize="1"
    PagerStyle-Mode="NumericPages"
    OnPageIndexChanged="DataGrid_Page"
    AutoGenerateColumns="true"
    runat=server
    >
    </asp:datagrid>
    </form>
    </body>
    </html>


    Rajesh

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Rajesh Tiwari Guest

Similar Threads

  1. CFSELECT POPULATED
    By sartini in forum Coldfusion Flash Integration
    Replies: 2
    Last Post: October 6th, 06:27 PM
  2. Replies: 0
    Last Post: September 7th, 04:12 AM
  3. Replies: 1
    Last Post: August 27th, 03:37 PM
  4. Replies: 2
    Last Post: October 8th, 01:48 PM
  5. Replies: 1
    Last Post: July 23rd, 05:41 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •