PageIndexChanged Intermittently not working??

  • Thread starter Thread starter Rubble
  • Start date Start date
R

Rubble

Ive been having some weird issues with the microsoft grid control and
its paging feature.

Overview: I have a webform that loads a custom user control. This
user control has several datagrids on it, but I only bind one from the
calling webform based on user selections.

Behavior: Once the grid displays I can go from page 1 to page 2
without any problem. I can also do the same from 2 to 3, 3 to
4...etc. I can also go from 4 to 3 or 3 to 2. Any time I try to go
back to page 1 however, it shows the same records from the previous
page and then shows the remaing records on page 1 if that lists is
longer. So if I have 4 records on page 2 and 6 records on page 1, the
grid will show six records consisting of 4 from page 2 and the last 2
records being correct records for page 1.

Issue: I step throught the code whenever I click on a page. Each
time I choose page, the PageIndexChanged event runs...except when I
select Page 1. Then it just skips the event all together.

How can this happen? Im really confused on this and could use some
advice.

Thanks!
x B. Rubble x
 
Unfortunately, I havent figured this out. It really appears to be a
bug, but I cant verify.

Do you have any suggestions?

Thanks,
x B. Rubble x
 
Alvin Bruney said:
Please post the original question and i would be happy to take a look



Thanks for the reply...Im still looking for an answer. Here is the
original post in case you didnt see it. Thanks!



----------------------------------->
Ive been having some weird issues with the microsoft grid control and
its paging feature.

Overview: I have a webform that loads a custom user control. This
user control has several datagrids on it, but I only bind one from the
calling webform based on user selections.

Behavior: Once the grid displays I can go from page 1 to page 2
without any problem. I can also do the same from 2 to 3, 3 to
4...etc. I can also go from 4 to 3 or 3 to 2. Any time I try to go
back to page 1 however, it shows the same records from the previous
page and then shows the remaing records on page 1 if that lists is
longer. So if I have 4 records on page 2 and 6 records on page 1, the
grid will show six records consisting of 4 from page 2 and the last 2
records being correct records for page 1.

Issue: I step throught the code whenever I click on a page. Each
time I choose page, the PageIndexChanged event runs...except when I
select Page 1. Then it just skips the event all together.

How can this happen? Im really confused on this and could use some
advice.

Thanks!
x B. Rubble x
<--------------------------------------
 
Thanks for working with me on this. Should I post the codebehind or
the grid stuff? There really isnt anything that special about the
code, but the architecture itself is a little different in that its a
web form that dynamically loads a control and its properties which are
a tab and a grid.

Check out the sample below and let me know if you need more code
sample.


This is the function in the parent web form that loads the control
with the two tabs containing grids.

public void MakeTab(string szManage)
{
//clear other controls
phItems.Controls.Clear();
_DataProp DATABAG = new _DataProp();

Control ctrl = new Control();
//ctrl = (SAM.Controls.tabmgmttemplate) LoadControl
(Request.ApplicationPath + Path.AltDirectorySeparatorChar +
"Controls/tabmgmttemplate.ascx");
ctrl = (SAM.Controls.tabmgmttemplate) LoadControl
("~/Controls/tabmgmttemplate.ascx");

string szUserID = ((_DataProp)
Session["databag"]).getValue("ID").ToString();

switch(szManage)
{
case "ASCPS":
((SAM.Controls.tabmgmttemplate)ctrl).TabName1 = "Pending ASCPS";
((SAM.Controls.tabmgmttemplate)ctrl).TabName2 = "Approved ASCPS";
((SAM.Controls.tabmgmttemplate)ctrl).URL =
"/SAM/Secure/ascps.aspx?update=true&id={0}";
((SAM.Controls.tabmgmttemplate)ctrl).PendingProc =
"procGetPendingItems";
((SAM.Controls.tabmgmttemplate)ctrl).ApprovedProc =
"procGetApprovedItems";

((SAM.Controls.tabmgmttemplate)ctrl).makeApprovedASCPS(szUserID);
((SAM.Controls.tabmgmttemplate)ctrl).makePendingASCPS(szUserID);

szTitle = "My ASCPS";

ViewState["grid"] = "ASCPS";

break;
case "Incoming Requests":

...
}

//delete and readd the ownerbag
ViewState["owner"] = "true";

Session.Add("MODE","valid");
Session.Add("ownerbag",DATABAG);

phItems.Controls.Add(ctrl);
}


This is the control containing the tabs and grids with sample code of
the function that makes the pending tab:

public void makePendingASCPS(string szUserID)
{

gearsbase gb = new gearsbase();
dbParams[] sParams = new dbParams[1];

//**********User ID***********
sParams[0].pName = "intUserID";
sParams[0].nValue = szUserID;
sParams[0].pType = System.Data.SqlDbType.Int;
sParams[0].pSize = 4;


try
{

DataSet dsAssets = new DataSet("dsAssets");
dsAssets = gb.doProcedure(szPending,sParams,sParams.Length,"dsAssets");

grdPendingASCPS.DataSource = dsAssets;
grdPendingASCPS.DataBind();

}
catch(SystemException k)
{
Debug.Write(k);
sambase.TransferError(this.Context,"Message",k.ToString(),"tabmgmttemplate.ascx");
}
finally
{
gb.dispose();
}

}
 
Back
Top