473,406 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

My Method Logic Question

I have the following situation.

I am creating my own user control.
This asp.net user control will have a method called "Read". When this
method is being called from the page. It will read line by line threw a
list dictionary. While reading line by line
it will be setting public properties that my page can access. So my user
control will look like this.

Usercontrol.ascx

public class clsUserControl
{
private string strMyPropertyValue;

public bool Read()
{
foreach(ListDictionary MyListRow in MyListDictionary)
{
strMyPropertyValue = (string)MyListRow.Value;
}
}

public string MyReturnedValue
{
set
{
MyReturnedValue = strMyPropertyValue;
}
}
}

Now, my webpage called webpage.aspx.
Will do the following.

public class clsMyWebPage
{
//This will reference my usercontrol on the webpage.
protected clsUserControl MyUserControl;

private void DoSomething()
{
string strGetValue;
while(MyUserControl.Read())
{
strGetValue = MyUserControl.MyReturnedValue;
}
}
}

My question is this. How do I get my ".Read" method to loop through each
row setting the public property for each new value it retrieves
from the ListDictionary? Also, meanwhile setting the .Read method to
"true" so the calling page while loop will keep looping? I hope this makes
sense.

Thanks,
Mark

Nov 22 '05 #1
2 837
I'm not completely sure I understand your question, but I'll take a stab:

public class clsUserControl
{
IDictionaryEnumerator enumerator =
MyListDictionary.GetEnumerator();

public bool Read()
{
return enumerator.MoveNext();
}

public string MyReturnedValue
{
get
{
return enumerator.Value.ToString();
}
}
}


SouthSpawn wrote:
I have the following situation.

I am creating my own user control.
This asp.net user control will have a method called "Read". When this
method is being called from the page. It will read line by line threw a
list dictionary. While reading line by line
it will be setting public properties that my page can access. So my user
control will look like this.

Usercontrol.ascx

public class clsUserControl
{
private string strMyPropertyValue;

public bool Read()
{
foreach(ListDictionary MyListRow in MyListDictionary)
{
strMyPropertyValue = (string)MyListRow.Value;
}
}

public string MyReturnedValue
{
set
{
MyReturnedValue = strMyPropertyValue;
}
}
}

Now, my webpage called webpage.aspx.
Will do the following.

public class clsMyWebPage
{
//This will reference my usercontrol on the webpage.
protected clsUserControl MyUserControl;

private void DoSomething()
{
string strGetValue;
while(MyUserControl.Read())
{
strGetValue = MyUserControl.MyReturnedValue;
}
}
}

My question is this. How do I get my ".Read" method to loop through each
row setting the public property for each new value it retrieves
from the ListDictionary? Also, meanwhile setting the .Read method to
"true" so the calling page while loop will keep looping? I hope this makes
sense.

Thanks,
Mark

Nov 22 '05 #2
JOSH!!!!!!!!!!

THANKS alot man. This is excatly what I needed.

Thanks,
Mark

Nov 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ruud de Jong | last post by:
The question I have is: how safe / future proof / portable is the use of the __subclasses__ method that exists for new-style classes? Background: I thought I had found an easy-to-understand...
7
by: Andy | last post by:
Hi all, This is more of a design question. I'm building an n-tier application, and the question revolves around the buisness layer telling the application that a value is not appropriate for...
5
by: Earl | last post by:
I need to call a method on an owned child form, and am wondering if the best way of doing this is to capture the Closing event of the form that passes control back to the form where I have the...
7
by: Abhishek | last post by:
Hi I am using a generic list in my program to have a list of objects stored. I want to compare all the objects in this list with object of another class and find all the objects which meet the...
11
by: eBob.com | last post by:
I have this nasty problem with Shared methods and what I think of as "global storage" - i.e. storage declared outside of any subroutines or functions. In the simple example below this "global"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.