Showing posts with label alli. Show all posts
Showing posts with label alli. Show all posts

Thursday, March 29, 2012

newbie - keeping my object data as page refreshes

Hi all

I have some experience in 'Windows' programming but I am new to Web
programming, I wonder if anyone can help.

I have a middle layer object that brings some data from a database class .
The class reprsents a Callout, has lots of methods and properties and
manages the business logic..

I then have a html page (GUI layer) that creates an instance of a callout,
and from the callout object, it displays some textfields, labour etc plus
some datagrids based on some collections it holds.

Everything works fine until the page refreshes, at which time the object
seems to be destroyed and then recreated.

I want to keep the object alive with its existing data, on the server, and
connect back to it , ie. not create a new object each time. I know I could
use my Callouts WriteDate event to persist the data back to the SQLServer,
and then just re load it, but this isn't what I really want. I would like to
keep the object live until all work has been completed.

I have read a few things about sessions states etc, but don't really know
where to start, and how to make the class persist.

initially I had

public partial class CallOutDetail : System.Web.UI.Page
{
ExistingCallout Currentcallout;
int m_CalloutPK = 0;

protected void Page_Load(object sender, EventArgs e)
{
m_CalloutPK = 1212;
Currentcallout = new ExistingCallout(m_CalloutPK);

I have tried putting the Currentcallout in not postback i.e.

public partial class CallOutDetail : System.Web.UI.Page
{
ExistingCallout Currentcallout;
int m_CalloutPK = 0;

protected void Page_Load(object sender, EventArgs e)
{
m_CalloutPK = 1212;
if (!IsPostBack)
{
// first time
Currentcallout = new ExistingCallout(m_CalloutPK);
SetLabour();
SetMaterials();
}

Any pointers would be welcome

thanks

Andycouple options...
both require that it be serialized

you can place it in the Page's viewstate...

private constant vs_callout="A";

protected CalloutType CurrentCallout{
get{return this.ViewState[vs_callout] as CalloutType;}
set{this.ViewState[vs_callout] = value;}
}

...or place it in the session
}

"AAJ" wrote:

Quote:

Originally Posted by

Hi all
>
I have some experience in 'Windows' programming but I am new to Web
programming, I wonder if anyone can help.
>
I have a middle layer object that brings some data from a database class .
The class reprsents a Callout, has lots of methods and properties and
manages the business logic..
>
I then have a html page (GUI layer) that creates an instance of a callout,
and from the callout object, it displays some textfields, labour etc plus
some datagrids based on some collections it holds.
>
Everything works fine until the page refreshes, at which time the object
seems to be destroyed and then recreated.
>
I want to keep the object alive with its existing data, on the server, and
connect back to it , ie. not create a new object each time. I know I could
use my Callouts WriteDate event to persist the data back to the SQLServer,
and then just re load it, but this isn't what I really want. I would like to
keep the object live until all work has been completed.
>
I have read a few things about sessions states etc, but don't really know
where to start, and how to make the class persist.
>
initially I had
>
public partial class CallOutDetail : System.Web.UI.Page
{
ExistingCallout Currentcallout;
int m_CalloutPK = 0;
>
protected void Page_Load(object sender, EventArgs e)
{
m_CalloutPK = 1212;
Currentcallout = new ExistingCallout(m_CalloutPK);
>
>
I have tried putting the Currentcallout in not postback i.e.
>
public partial class CallOutDetail : System.Web.UI.Page
{
ExistingCallout Currentcallout;
int m_CalloutPK = 0;
>
protected void Page_Load(object sender, EventArgs e)
{
m_CalloutPK = 1212;
if (!IsPostBack)
{
// first time
Currentcallout = new ExistingCallout(m_CalloutPK);
SetLabour();
SetMaterials();
}
>
>
Any pointers would be welcome
>
thanks
>
Andy
>
>
>


thanks David

"David Jessee" <DavidJessee@.discussions.microsoft.comwrote in message
news:CF0F5237-8616-4C4B-9DA9-252BA0946C1D@.microsoft.com...

Quote:

Originally Posted by

couple options...
both require that it be serialized
>
you can place it in the Page's viewstate...
>
private constant vs_callout="A";
>
protected CalloutType CurrentCallout{
get{return this.ViewState[vs_callout] as CalloutType;}
set{this.ViewState[vs_callout] = value;}
}
>
...or place it in the session
}
>
>
>
"AAJ" wrote:
>

Quote:

Originally Posted by

>Hi all
>>
>I have some experience in 'Windows' programming but I am new to Web
>programming, I wonder if anyone can help.
>>
>I have a middle layer object that brings some data from a database class
>.
>The class reprsents a Callout, has lots of methods and properties and
>manages the business logic..
>>
>I then have a html page (GUI layer) that creates an instance of a
>callout,
>and from the callout object, it displays some textfields, labour etc plus
>some datagrids based on some collections it holds.
>>
>Everything works fine until the page refreshes, at which time the object
>seems to be destroyed and then recreated.
>>
>I want to keep the object alive with its existing data, on the server,
>and
>connect back to it , ie. not create a new object each time. I know I
>could
>use my Callouts WriteDate event to persist the data back to the
>SQLServer,
>and then just re load it, but this isn't what I really want. I would like
>to
>keep the object live until all work has been completed.
>>
>I have read a few things about sessions states etc, but don't really know
>where to start, and how to make the class persist.
>>
>initially I had
>>
>public partial class CallOutDetail : System.Web.UI.Page
>{
>ExistingCallout Currentcallout;
>int m_CalloutPK = 0;
>>
>protected void Page_Load(object sender, EventArgs e)
>{
>m_CalloutPK = 1212;
>Currentcallout = new ExistingCallout(m_CalloutPK);
>>
>>
>I have tried putting the Currentcallout in not postback i.e.
>>
>public partial class CallOutDetail : System.Web.UI.Page
>{
>ExistingCallout Currentcallout;
>int m_CalloutPK = 0;
>>
>protected void Page_Load(object sender, EventArgs e)
>{
>m_CalloutPK = 1212;
>if (!IsPostBack)
>{
>// first time
>Currentcallout = new ExistingCallout(m_CalloutPK);
>SetLabour();
>SetMaterials();
>}
>>
>>
>Any pointers would be welcome
>>
>thanks
>>
>Andy
>>
>>
>>

Saturday, March 24, 2012

NEWBIE HELP

Hi All

I have a web form that uses an object class to populate a standard table (not datagrid etc)

I have a button on this form that when clicked opens another form for editing. In this form all the values of the object are used to populate text boxes (in the load event of the form there is a call to a DBHelper class which uses a SQL Parameter Array to execute a strored procedure (SQL) and return the data) and text areas which are free to edit in this form.

Also on this page I have a button called save changes which when clicked I am attempting to create a new paramater array to execute an update procedure again using the DBHelper Class.

Unfortunately when I try to do this the values in the new SQLParamater Array are exactly the same as before and are not reflecting the changes that I make by typing new entries into the text boxes on the form. As a newbie to .net I am lost here and realise that this is probably a scope or state problem but I would like someone to point me in the right direction please. When I hard wire the new SQLParamater Array the update does work so that eliminates the chances of the DBHelper Class from any fault.

Please help as I am going bonkers here!!!!!

Phill

You probably have your "populate form" bit in your Page Load function - which will execute when the save button causes a post back.

Surround your "populate the textboxes" code with:

if (!IsPostBack)
{

...

}

This will mean it only runs when the page is first loaded.


Have you looked if your sql update statement is passing the values as @.new_value

I would recommend doing this on a datagrid, it would be easier to update cuz the datagrid already has an update command field!


I cant use a datagrid as the recordset only ever returns one row with 17 fields. Datagrids need multirows to work dont they?


Datagrids work with "a number" of rows - that can be one row.


welshpunk:

I cant use a datagrid as the recordset only ever returns one row with 17 fields. Datagrids need multirows to work dont they?

Hi welshpunk,

Try to follow those codes as follows:

Working with a Single Table
http://msdn2.microsoft.com/en-us/library/aa719548(VS.71).aspx

Thanks.


Yes but you cannot turn a datagrid on its side. I have 17 fields in the recordset(just one row) Using a datagrid in this fashion is not user friendly as some of the fields are up to 2000 chars long. Datagrids will display like this

Column Heading Column Heading Column Heading Column Heading Column Heading

Data Data Data Data Data

I want to display the data in a more user friendly way like this

Column Header Data

Column Header Data

Column Header Data

Column Header Data

Column Header Data

Column Header Data

Column Header Data

With the 17 column headers on the left and their respective data adjacent to them. This is why I had to create the form in this way.


Hi,

You can write each cell every time by reading each cell once.

Hope this helps.


I have already marked as answer


Don't worry - you'll soon see that comment about marking posts as the answer absolutely everywhere!


You could try using a detailsview. The data would be displayed the way you want.

Thursday, March 22, 2012

Newbie IMAGE SRC question

Hello all!
I basicly know how to pull a image down with using Image source in HTML. By
telling image src what file name to open. But if I have the file path stored
in a SQL database. such as c:/mypictures/myimagefile.gif, how would I call
that back up, to show that file with out typing the path in my code. Can I
just refrence the sql server, and read that file path? What would be the
correct way of writing that in my code. Or am I totally off base, and do
this an entirely diffrent way.
TIA!!!
RudyYou'll have to write code to pull the image form your database then write
it to the Response.OutputStream. I have a sample app that should get you
started:
http://staff.develop.com/ballen/blo.../>
aff48bf2481
-Brock
DevelopMentor
http://staff.develop.com/ballen

> Hello all!
> I basicly know how to pull a image down with using Image source in
> HTML. By telling image src what file name to open. But if I have the
> file path stored in a SQL database. such as
> c:/mypictures/myimagefile.gif, how would I call that back up, to show
> that file with out typing the path in my code. Can I just refrence
> the sql server, and read that file path? What would be the correct
> way of writing that in my code. Or am I totally off base, and do this
> an entirely diffrent way.
> TIA!!!
> Rudy
>
This article explains in detail how to pull files from a database and
display them dynamically to the user:
http://steveorr.net/articles/EasyUploads.aspx
This one explains how to generate images dynamically and display them to the
user:
http://steveorr.net/articles/ImproveYourImages.aspx
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Rudy" <Rudy@.discussions.microsoft.com> wrote in message
news:B76F371F-B5A7-42F4-BCAD-56FF560D8A99@.microsoft.com...
> Hello all!
> I basicly know how to pull a image down with using Image source in HTML.
> By
> telling image src what file name to open. But if I have the file path
> stored
> in a SQL database. such as c:/mypictures/myimagefile.gif, how would I call
> that back up, to show that file with out typing the path in my code. Can
> I
> just refrence the sql server, and read that file path? What would be the
> correct way of writing that in my code. Or am I totally off base, and do
> this an entirely diffrent way.
> TIA!!!
> Rudy
Hi Brock and Steve,
Thank you for the advise. I'll try it out tonite. I just want to make sure
I'm clear, I am not storing the image in the SQL db, just the filepath. Wil
l
this still work?
Thanks for your help!!!!
"Steve C. Orr [MVP, MCSD]" wrote:

> This article explains in detail how to pull files from a database and
> display them dynamically to the user:
> http://steveorr.net/articles/EasyUploads.aspx
> This one explains how to generate images dynamically and display them to t
he
> user:
> http://steveorr.net/articles/ImproveYourImages.aspx
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://SteveOrr.net
>
> "Rudy" <Rudy@.discussions.microsoft.com> wrote in message
> news:B76F371F-B5A7-42F4-BCAD-56FF560D8A99@.microsoft.com...
>
>
It should be roughly similar.
The main difference would be that (instead of grabbing the bytes from a
database field) you'll probably be using Response.WriteFile.
Here's more info on Response.WriteFile
http://msdn.microsoft.com/library/d...tefiletopic.asp
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Rudy" <Rudy@.discussions.microsoft.com> wrote in message
news:B91B851D-4A86-4A35-A6C2-F43ACC83E0A9@.microsoft.com...
> Hi Brock and Steve,
> Thank you for the advise. I'll try it out tonite. I just want to make
> sure
> I'm clear, I am not storing the image in the SQL db, just the filepath.
> Will
> this still work?
> Thanks for your help!!!!
> "Steve C. Orr [MVP, MCSD]" wrote:
>

Newbie IMAGE SRC question

Hello all!

I basicly know how to pull a image down with using Image source in HTML. By
telling image src what file name to open. But if I have the file path stored
in a SQL database. such as c:/mypictures/myimagefile.gif, how would I call
that back up, to show that file with out typing the path in my code. Can I
just refrence the sql server, and read that file path? What would be the
correct way of writing that in my code. Or am I totally off base, and do
this an entirely diffrent way.

TIA!!!

RudyYou'll have to write code to pull the image form your database then write
it to the Response.OutputStream. I have a sample app that should get you
started:

http://staff.develop.com/ballen/blo...f8-9aff48bf2481

-Brock
DevelopMentor
http://staff.develop.com/ballen

> Hello all!
> I basicly know how to pull a image down with using Image source in
> HTML. By telling image src what file name to open. But if I have the
> file path stored in a SQL database. such as
> c:/mypictures/myimagefile.gif, how would I call that back up, to show
> that file with out typing the path in my code. Can I just refrence
> the sql server, and read that file path? What would be the correct
> way of writing that in my code. Or am I totally off base, and do this
> an entirely diffrent way.
> TIA!!!
> Rudy
This article explains in detail how to pull files from a database and
display them dynamically to the user:
http://steveorr.net/articles/EasyUploads.aspx

This one explains how to generate images dynamically and display them to the
user:
http://steveorr.net/articles/ImproveYourImages.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Rudy" <Rudy@.discussions.microsoft.com> wrote in message
news:B76F371F-B5A7-42F4-BCAD-56FF560D8A99@.microsoft.com...
> Hello all!
> I basicly know how to pull a image down with using Image source in HTML.
> By
> telling image src what file name to open. But if I have the file path
> stored
> in a SQL database. such as c:/mypictures/myimagefile.gif, how would I call
> that back up, to show that file with out typing the path in my code. Can
> I
> just refrence the sql server, and read that file path? What would be the
> correct way of writing that in my code. Or am I totally off base, and do
> this an entirely diffrent way.
> TIA!!!
> Rudy
Hi Brock and Steve,

Thank you for the advise. I'll try it out tonite. I just want to make sure
I'm clear, I am not storing the image in the SQL db, just the filepath. Will
this still work?

Thanks for your help!!!!

"Steve C. Orr [MVP, MCSD]" wrote:

> This article explains in detail how to pull files from a database and
> display them dynamically to the user:
> http://steveorr.net/articles/EasyUploads.aspx
> This one explains how to generate images dynamically and display them to the
> user:
> http://steveorr.net/articles/ImproveYourImages.aspx
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://SteveOrr.net
>
> "Rudy" <Rudy@.discussions.microsoft.com> wrote in message
> news:B76F371F-B5A7-42F4-BCAD-56FF560D8A99@.microsoft.com...
> > Hello all!
> > I basicly know how to pull a image down with using Image source in HTML.
> > By
> > telling image src what file name to open. But if I have the file path
> > stored
> > in a SQL database. such as c:/mypictures/myimagefile.gif, how would I call
> > that back up, to show that file with out typing the path in my code. Can
> > I
> > just refrence the sql server, and read that file path? What would be the
> > correct way of writing that in my code. Or am I totally off base, and do
> > this an entirely diffrent way.
> > TIA!!!
> > Rudy
>
It should be roughly similar.
The main difference would be that (instead of grabbing the bytes from a
database field) you'll probably be using Response.WriteFile.

Here's more info on Response.WriteFile
http://msdn.microsoft.com/library/d...tefiletopic.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Rudy" <Rudy@.discussions.microsoft.com> wrote in message
news:B91B851D-4A86-4A35-A6C2-F43ACC83E0A9@.microsoft.com...
> Hi Brock and Steve,
> Thank you for the advise. I'll try it out tonite. I just want to make
> sure
> I'm clear, I am not storing the image in the SQL db, just the filepath.
> Will
> this still work?
> Thanks for your help!!!!
> "Steve C. Orr [MVP, MCSD]" wrote:
>> This article explains in detail how to pull files from a database and
>> display them dynamically to the user:
>> http://steveorr.net/articles/EasyUploads.aspx
>>
>> This one explains how to generate images dynamically and display them to
>> the
>> user:
>> http://steveorr.net/articles/ImproveYourImages.aspx
>>
>> --
>> I hope this helps,
>> Steve C. Orr, MCSD, MVP
>> http://SteveOrr.net
>>
>>
>> "Rudy" <Rudy@.discussions.microsoft.com> wrote in message
>> news:B76F371F-B5A7-42F4-BCAD-56FF560D8A99@.microsoft.com...
>> > Hello all!
>>> > I basicly know how to pull a image down with using Image source in
>> > HTML.
>> > By
>> > telling image src what file name to open. But if I have the file path
>> > stored
>> > in a SQL database. such as c:/mypictures/myimagefile.gif, how would I
>> > call
>> > that back up, to show that file with out typing the path in my code.
>> > Can
>> > I
>> > just refrence the sql server, and read that file path? What would be
>> > the
>> > correct way of writing that in my code. Or am I totally off base, and
>> > do
>> > this an entirely diffrent way.
>>> > TIA!!!
>>> > Rudy
>>
>>
>

Friday, March 16, 2012

NEWBIE Paging question

Hi All!
I have a datagrid, with paging. I get this error

AllowCustomPaging must be true and VirtualItemCount must be set for a
DataGrid with ID dgGal when AllowPaging is set to true and the selected
datasource does not implement ICollection.

Where would I set the Virtual Item Count?

Or do I have bigger problems than this?

Thanks!

Rudy

Thanks!!What type of object is ur Datasource ??
" datasource does not implement ICollection"
Post some code..
--
http://pathidotnet.blogspot.com
=====
vInAypAtHi
o__
--_,>/'_--
(_) \(_)
-----

"Rudy" wrote:

> Hi All!
> I have a datagrid, with paging. I get this error
> AllowCustomPaging must be true and VirtualItemCount must be set for a
> DataGrid with ID dgGal when AllowPaging is set to true and the selected
> datasource does not implement ICollection.
> Where would I set the Virtual Item Count?
> Or do I have bigger problems than this?
> Thanks!
> Rudy
> Thanks!!
Hey Vinay!

I'm using SQL, and a datagrid. If I turn "AllowCustomPaging" to true, my
data loads up, but no paging. If I set it to false, I get the error. Here
is some code.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'PreLoad Members
Dim dbConn As New SqlConnection(ConnString)
Dim drPrev As SqlDataReader
Dim cmdGal As SqlCommand

cmdGal = New SqlCommand("Gal", dbConn)
cmdGal.CommandType = CommandType.StoredProcedure
dbConn.Open()
drPrev = cmdGal.ExecuteReader
dgGal.DataSource = drPrev
dgGal.DataBind()
drPrev.Close()
dbConn.Close()
End Sub
Private Sub dgGal_PageIndexChanged(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridPageChangedEvent Args) Handles
dgGal.PageIndexChanged
dgGal.CurrentPageIndex = e.NewPageIndex
Dim dbConn As New SqlConnection(ConnString)
Dim drPrev As SqlDataReader
Dim cmdGal As SqlCommand

cmdGal = New SqlCommand("Gal", dbConn)
cmdGal.CommandType = CommandType.StoredProcedure
dbConn.Open()
drPrev = cmdGal.ExecuteReader
dgGal.DataSource = drPrev
dgGal.DataBind()
drPrev.Close()
dbConn.Close()
End Sub

Thanks!!
Rudy

"vinay" wrote:

> What type of object is ur Datasource ??
> " datasource does not implement ICollection"
> Post some code..
> --
> http://pathidotnet.blogspot.com
> =====
> vInAypAtHi
> o__
> --_,>/'_--
> (_) \(_)
> -----
>
> "Rudy" wrote:
> > Hi All!
> > I have a datagrid, with paging. I get this error
> > AllowCustomPaging must be true and VirtualItemCount must be set for a
> > DataGrid with ID dgGal when AllowPaging is set to true and the selected
> > datasource does not implement ICollection.
> > Where would I set the Virtual Item Count?
> > Or do I have bigger problems than this?
> > Thanks!
> > Rudy
> > Thanks!!
Rudy,

I am not sure if it's valid to bind a new DataSource to a Grid in the
PageIndexChanged Event. Wouldn't this resultin an endless loop? Did you
debug your code? Where exactly does your code fail?

Greetings

Daniel

"Rudy" <Rudy@.discussions.microsoft.com> schrieb im Newsbeitrag
news:FFAE955D-AF16-4E9F-AA12-258154390E1D@.microsoft.com...
> Hey Vinay!
> I'm using SQL, and a datagrid. If I turn "AllowCustomPaging" to true, my
> data loads up, but no paging. If I set it to false, I get the error.
> Here
> is some code.
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> 'PreLoad Members
> Dim dbConn As New SqlConnection(ConnString)
> Dim drPrev As SqlDataReader
> Dim cmdGal As SqlCommand
> cmdGal = New SqlCommand("Gal", dbConn)
> cmdGal.CommandType = CommandType.StoredProcedure
> dbConn.Open()
> drPrev = cmdGal.ExecuteReader
> dgGal.DataSource = drPrev
> dgGal.DataBind()
> drPrev.Close()
> dbConn.Close()
> End Sub
> Private Sub dgGal_PageIndexChanged(ByVal source As Object, ByVal e As
> System.Web.UI.WebControls.DataGridPageChangedEvent Args) Handles
> dgGal.PageIndexChanged
> dgGal.CurrentPageIndex = e.NewPageIndex
> Dim dbConn As New SqlConnection(ConnString)
> Dim drPrev As SqlDataReader
> Dim cmdGal As SqlCommand
> cmdGal = New SqlCommand("Gal", dbConn)
> cmdGal.CommandType = CommandType.StoredProcedure
> dbConn.Open()
> drPrev = cmdGal.ExecuteReader
> dgGal.DataSource = drPrev
> dgGal.DataBind()
> drPrev.Close()
> dbConn.Close()
> End Sub
> Thanks!!
> Rudy
> "vinay" wrote:
>> What type of object is ur Datasource ??
>> " datasource does not implement ICollection"
>> Post some code..
>> --
>> http://pathidotnet.blogspot.com
>> =====
>> vInAypAtHi
>> o__
>> --_,>/'_--
>> (_) \(_)
>> -----
>>
>>
>> "Rudy" wrote:
>>
>> > Hi All!
>> > I have a datagrid, with paging. I get this error
>>> > AllowCustomPaging must be true and VirtualItemCount must be set for a
>> > DataGrid with ID dgGal when AllowPaging is set to true and the selected
>> > datasource does not implement ICollection.
>>> > Where would I set the Virtual Item Count?
>>> > Or do I have bigger problems than this?
>>> > Thanks!
>>> > Rudy
>>> > Thanks!!
Hi Dan!!
Sorry, I was goin to show where it fails, forgot.
Not sure at this point what's valid or not. I always get stuck with paging
things. Here where it fails

dbConn.Open()
> > drPrev = cmdGal.ExecuteReader
> > dgGal.DataSource = drPrev
FAIL> > dgGal.DataBind()
> > drPrev.Close()
> > dbConn.Close()

Thanks!!!

"Daniel Walzenbach" wrote:

> Rudy,
> I am not sure if it's valid to bind a new DataSource to a Grid in the
> PageIndexChanged Event. Wouldn't this resultin an endless loop? Did you
> debug your code? Where exactly does your code fail?
> Greetings
> Daniel
>
> "Rudy" <Rudy@.discussions.microsoft.com> schrieb im Newsbeitrag
> news:FFAE955D-AF16-4E9F-AA12-258154390E1D@.microsoft.com...
> > Hey Vinay!
> > I'm using SQL, and a datagrid. If I turn "AllowCustomPaging" to true, my
> > data loads up, but no paging. If I set it to false, I get the error.
> > Here
> > is some code.
> > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles MyBase.Load
> > 'PreLoad Members
> > Dim dbConn As New SqlConnection(ConnString)
> > Dim drPrev As SqlDataReader
> > Dim cmdGal As SqlCommand
> > cmdGal = New SqlCommand("Gal", dbConn)
> > cmdGal.CommandType = CommandType.StoredProcedure
> > dbConn.Open()
> > drPrev = cmdGal.ExecuteReader
> > dgGal.DataSource = drPrev
> > dgGal.DataBind()
> > drPrev.Close()
> > dbConn.Close()
> > End Sub
> > Private Sub dgGal_PageIndexChanged(ByVal source As Object, ByVal e As
> > System.Web.UI.WebControls.DataGridPageChangedEvent Args) Handles
> > dgGal.PageIndexChanged
> > dgGal.CurrentPageIndex = e.NewPageIndex
> > Dim dbConn As New SqlConnection(ConnString)
> > Dim drPrev As SqlDataReader
> > Dim cmdGal As SqlCommand
> > cmdGal = New SqlCommand("Gal", dbConn)
> > cmdGal.CommandType = CommandType.StoredProcedure
> > dbConn.Open()
> > drPrev = cmdGal.ExecuteReader
> > dgGal.DataSource = drPrev
> > dgGal.DataBind()
> > drPrev.Close()
> > dbConn.Close()
> > End Sub
> > Thanks!!
> > Rudy
> > "vinay" wrote:
> >> What type of object is ur Datasource ??
> >> " datasource does not implement ICollection"
> >> Post some code..
> >> --
> >> http://pathidotnet.blogspot.com
> >> =====
> >> vInAypAtHi
> >> o__
> >> --_,>/'_--
> >> (_) \(_)
> >> -----
> >>
> >>
> >> "Rudy" wrote:
> >>
> >> > Hi All!
> >> > I have a datagrid, with paging. I get this error
> >> >> > AllowCustomPaging must be true and VirtualItemCount must be set for a
> >> > DataGrid with ID dgGal when AllowPaging is set to true and the selected
> >> > datasource does not implement ICollection.
> >> >> > Where would I set the Virtual Item Count?
> >> >> > Or do I have bigger problems than this?
> >> >> > Thanks!
> >> >> > Rudy
> >> >> > Thanks!!
>
Hello Rudy,

and this is in which event-handler? MyBase.Load or dgGal.PageIndexChanged?

"Rudy" <Rudy@.discussions.microsoft.com> schrieb im Newsbeitrag
news:CF0F889F-14B4-4CF4-ACAB-26D9D316B682@.microsoft.com...
> Hi Dan!!
> Sorry, I was goin to show where it fails, forgot.
> Not sure at this point what's valid or not. I always get stuck with
> paging
> things. Here where it fails
> dbConn.Open()
>> > drPrev = cmdGal.ExecuteReader
>> > dgGal.DataSource = drPrev
> FAIL> > dgGal.DataBind()
>> > drPrev.Close()
>> > dbConn.Close()
>
> Thanks!!!
>
> "Daniel Walzenbach" wrote:
>> Rudy,
>>
>> I am not sure if it's valid to bind a new DataSource to a Grid in the
>> PageIndexChanged Event. Wouldn't this resultin an endless loop? Did you
>> debug your code? Where exactly does your code fail?
>>
>> Greetings
>>
>> Daniel
>>
>>
>> "Rudy" <Rudy@.discussions.microsoft.com> schrieb im Newsbeitrag
>> news:FFAE955D-AF16-4E9F-AA12-258154390E1D@.microsoft.com...
>> > Hey Vinay!
>>> > I'm using SQL, and a datagrid. If I turn "AllowCustomPaging" to true,
>> > my
>> > data loads up, but no paging. If I set it to false, I get the error.
>> > Here
>> > is some code.
>>> > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
>> > System.EventArgs) Handles MyBase.Load
>>> > 'PreLoad Members
>> > Dim dbConn As New SqlConnection(ConnString)
>> > Dim drPrev As SqlDataReader
>> > Dim cmdGal As SqlCommand
>>> > cmdGal = New SqlCommand("Gal", dbConn)
>> > cmdGal.CommandType = CommandType.StoredProcedure
>> > dbConn.Open()
>> > drPrev = cmdGal.ExecuteReader
>> > dgGal.DataSource = drPrev
>> > dgGal.DataBind()
>> > drPrev.Close()
>> > dbConn.Close()
>> > End Sub
>> > Private Sub dgGal_PageIndexChanged(ByVal source As Object, ByVal e As
>> > System.Web.UI.WebControls.DataGridPageChangedEvent Args) Handles
>> > dgGal.PageIndexChanged
>> > dgGal.CurrentPageIndex = e.NewPageIndex
>> > Dim dbConn As New SqlConnection(ConnString)
>> > Dim drPrev As SqlDataReader
>> > Dim cmdGal As SqlCommand
>>> > cmdGal = New SqlCommand("Gal", dbConn)
>> > cmdGal.CommandType = CommandType.StoredProcedure
>> > dbConn.Open()
>> > drPrev = cmdGal.ExecuteReader
>> > dgGal.DataSource = drPrev
>> > dgGal.DataBind()
>> > drPrev.Close()
>> > dbConn.Close()
>> > End Sub
>>> > Thanks!!
>> > Rudy
>>> > "vinay" wrote:
>>> >> What type of object is ur Datasource ??
>> >> " datasource does not implement ICollection"
>> >> Post some code..
>> >> --
>> >> http://pathidotnet.blogspot.com
>> >> =====
>> >> vInAypAtHi
>> >> o__
>> >> --_,>/'_--
>> >> (_) \(_)
>> >> -----
>> >>
>> >>
>> >> "Rudy" wrote:
>> >>
>> >> > Hi All!
>> >> > I have a datagrid, with paging. I get this error
>> >>> >> > AllowCustomPaging must be true and VirtualItemCount must be set for
>> >> > a
>> >> > DataGrid with ID dgGal when AllowPaging is set to true and the
>> >> > selected
>> >> > datasource does not implement ICollection.
>> >>> >> > Where would I set the Virtual Item Count?
>> >>> >> > Or do I have bigger problems than this?
>> >>> >> > Thanks!
>> >>> >> > Rudy
>> >>> >> > Thanks!!
>>
>>
>
Mybase.Load

"Daniel Walzenbach" wrote:

> Hello Rudy,
> and this is in which event-handler? MyBase.Load or dgGal.PageIndexChanged?
>
>
> "Rudy" <Rudy@.discussions.microsoft.com> schrieb im Newsbeitrag
> news:CF0F889F-14B4-4CF4-ACAB-26D9D316B682@.microsoft.com...
> > Hi Dan!!
> > Sorry, I was goin to show where it fails, forgot.
> > Not sure at this point what's valid or not. I always get stuck with
> > paging
> > things. Here where it fails
> > dbConn.Open()
> >> > drPrev = cmdGal.ExecuteReader
> >> > dgGal.DataSource = drPrev
> > FAIL> > dgGal.DataBind()
> >> > drPrev.Close()
> >> > dbConn.Close()
> > Thanks!!!
> > "Daniel Walzenbach" wrote:
> >> Rudy,
> >>
> >> I am not sure if it's valid to bind a new DataSource to a Grid in the
> >> PageIndexChanged Event. Wouldn't this resultin an endless loop? Did you
> >> debug your code? Where exactly does your code fail?
> >>
> >> Greetings
> >>
> >> Daniel
> >>
> >>
> >> "Rudy" <Rudy@.discussions.microsoft.com> schrieb im Newsbeitrag
> >> news:FFAE955D-AF16-4E9F-AA12-258154390E1D@.microsoft.com...
> >> > Hey Vinay!
> >> >> > I'm using SQL, and a datagrid. If I turn "AllowCustomPaging" to true,
> >> > my
> >> > data loads up, but no paging. If I set it to false, I get the error.
> >> > Here
> >> > is some code.
> >> >> > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> >> > System.EventArgs) Handles MyBase.Load
> >> >> > 'PreLoad Members
> >> > Dim dbConn As New SqlConnection(ConnString)
> >> > Dim drPrev As SqlDataReader
> >> > Dim cmdGal As SqlCommand
> >> >> > cmdGal = New SqlCommand("Gal", dbConn)
> >> > cmdGal.CommandType = CommandType.StoredProcedure
> >> > dbConn.Open()
> >> > drPrev = cmdGal.ExecuteReader
> >> > dgGal.DataSource = drPrev
> >> > dgGal.DataBind()
> >> > drPrev.Close()
> >> > dbConn.Close()
> >> > End Sub
> >> > Private Sub dgGal_PageIndexChanged(ByVal source As Object, ByVal e As
> >> > System.Web.UI.WebControls.DataGridPageChangedEvent Args) Handles
> >> > dgGal.PageIndexChanged
> >> > dgGal.CurrentPageIndex = e.NewPageIndex
> >> > Dim dbConn As New SqlConnection(ConnString)
> >> > Dim drPrev As SqlDataReader
> >> > Dim cmdGal As SqlCommand
> >> >> > cmdGal = New SqlCommand("Gal", dbConn)
> >> > cmdGal.CommandType = CommandType.StoredProcedure
> >> > dbConn.Open()
> >> > drPrev = cmdGal.ExecuteReader
> >> > dgGal.DataSource = drPrev
> >> > dgGal.DataBind()
> >> > drPrev.Close()
> >> > dbConn.Close()
> >> > End Sub
> >> >> > Thanks!!
> >> > Rudy
> >> >> > "vinay" wrote:
> >> >> >> What type of object is ur Datasource ??
> >> >> " datasource does not implement ICollection"
> >> >> Post some code..
> >> >> --
> >> >> http://pathidotnet.blogspot.com
> >> >> =====
> >> >> vInAypAtHi
> >> >> o__
> >> >> --_,>/'_--
> >> >> (_) \(_)
> >> >> -----
> >> >>
> >> >>
> >> >> "Rudy" wrote:
> >> >>
> >> >> > Hi All!
> >> >> > I have a datagrid, with paging. I get this error
> >> >> >> >> > AllowCustomPaging must be true and VirtualItemCount must be set for
> >> >> > a
> >> >> > DataGrid with ID dgGal when AllowPaging is set to true and the
> >> >> > selected
> >> >> > datasource does not implement ICollection.
> >> >> >> >> > Where would I set the Virtual Item Count?
> >> >> >> >> > Or do I have bigger problems than this?
> >> >> >> >> > Thanks!
> >> >> >> >> > Rudy
> >> >> >> >> > Thanks!!
> >>
> >>
> >>
>