Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Pasing an ICollection to a usercontrol

Reply
Thread Tools

Pasing an ICollection to a usercontrol

 
 
Jamil Zahoor
Guest
Posts: n/a
 
      02-16-2005
I have a UserControl (CustomGrid.ascx) that displays a
DataGrid and contains page navigation with bi-directional
Sorting. This UserControl has, among other methods and
properties: (psuedo-code)
- public spname as string
- public Sub SetSpName (s as string)
- lblspname as Label

spname represents the name of the stored procedure that
will return the data. I created a Label on the
CustomGrid.ascx to store this spname between postbacks.

I'm using CustomGrid.ascx in a search page
(SearchCompanies.aspx). The search page consists of a
few TextBoxes to gather search criteria from a user. It
also contains a Search button.

I'm traversing through the TextBoxes on the
SearchCompanies page and building an ICollection that
contains the SQLParameter objects.

I need to pass both the spname and the ICollection object
from SearchCompanies.aspx page to the CustomGrid.ascx
control upon btnSearch click.

I can't find an efficient way to have the ICollection
object persist between postbacks. I've searched the
internet for answers as well but in vain. I can get the
first set of results. But when the [Next Page] link on
the CustomGrid.ascx is clicked, it does a postback and
forgets the ICollection object that it needs to bind the
datagrid.

Any insight would be appreciated.

Jamil

 
Reply With Quote
 
 
 
 
Guest
Posts: n/a
 
      02-17-2005
I believe ICollections can be added to either the ViewState
Look into how to add and retrieve items from the ViewState and see if that
fits what you need.
something ridiculously simple to be followed could be using this in your
OnLoad
if (ViewState["DataAction"]!=null)

{

DataAction = (DataActions) ViewState["DataAction"];

}

else

{

ViewState.Add("DataAction", DataAction);

}


and then override your Render method and ViewState.Add("...", value) ; You
do it in the Render to make sure that if you change the item that it the
latest version is saved.

Hope some of these tips help


View
"Jamil Zahoor" <(E-Mail Removed)> wrote in message
news:12bb01c5146b$b76876a0$(E-Mail Removed)...
>I have a UserControl (CustomGrid.ascx) that displays a
> DataGrid and contains page navigation with bi-directional
> Sorting. This UserControl has, among other methods and
> properties: (psuedo-code)
> - public spname as string
> - public Sub SetSpName (s as string)
> - lblspname as Label
>
> spname represents the name of the stored procedure that
> will return the data. I created a Label on the
> CustomGrid.ascx to store this spname between postbacks.
>
> I'm using CustomGrid.ascx in a search page
> (SearchCompanies.aspx). The search page consists of a
> few TextBoxes to gather search criteria from a user. It
> also contains a Search button.
>
> I'm traversing through the TextBoxes on the
> SearchCompanies page and building an ICollection that
> contains the SQLParameter objects.
>
> I need to pass both the spname and the ICollection object
> from SearchCompanies.aspx page to the CustomGrid.ascx
> control upon btnSearch click.
>
> I can't find an efficient way to have the ICollection
> object persist between postbacks. I've searched the
> internet for answers as well but in vain. I can get the
> first set of results. But when the [Next Page] link on
> the CustomGrid.ascx is clicked, it does a postback and
> forgets the ICollection object that it needs to bind the
> datagrid.
>
> Any insight would be appreciated.
>
> Jamil
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
pasing data between 2 win XP boxes via internet Dave Lilley Ruby 22 01-01-2010 08:20 PM
pasing an array pointer and storing as a class member stephen b C++ 14 10-17-2007 05:43 PM
Passing an ICollection object to a UserControl Jamil Zahoor ASP .Net Web Controls 1 02-17-2005 12:10 AM
method type ICollection returns Dataview Janus Knudsen ASP .Net 1 07-06-2004 06:04 AM
Pasing a reference to my page's Response.Cookies collection Scott ASP .Net 2 08-12-2003 07:57 PM



Advertisments