473,387 Members | 1,899 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,387 software developers and data experts.

loop througth Literials using foreach!!

In my web application i use satalite assembly to localize my web form..
Instead of set the each control text to the resourcemanager getstring()
method i try to use foreach loop

private string rmg(string key)
{
return resource.GetString("key");
}

private Literal ctrl_txt()
{
foreach (Literal lit_xyz in this.Controls)
{
string str= lit_xyz.ID;
string key= str.Substring(3);
lit_xyz.Text= rmg(key);
return lit_xyz;
}
return null;
}

this foreach genrate InvalidCastException... How can i fix this??
Nov 16 '05 #1
1 1210
You can see my reply to your post in the asp.net group.

DalePres
MCAD, MCDBA, MCSE.
"Islam Elkhayat" <is******@yahoo.com> wrote in message
news:Os**************@TK2MSFTNGP10.phx.gbl...
In my web application i use satalite assembly to localize my web form..
Instead of set the each control text to the resourcemanager getstring()
method i try to use foreach loop

private string rmg(string key)
{
return resource.GetString("key");
}

private Literal ctrl_txt()
{
foreach (Literal lit_xyz in this.Controls)
{
string str= lit_xyz.ID;
string key= str.Substring(3);
lit_xyz.Text= rmg(key);
return lit_xyz;
}
return null;
}

this foreach genrate InvalidCastException... How can i fix this??

Nov 16 '05 #2

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

Similar topics

3
by: Filippo P. | last post by:
Hi there, I have a menu (Collection) that needs to be trimmed based on security access of the logged user. protected void AdjustMenuBasedOnUserSecurity(Items ItemsList) { foreach (Item i in...
16
by: Islam Elkhayat | last post by:
In my web application i use satalite assembly to localize my web form.. Instead of set the each control text to the resourcemanager getstring() method i try to use foreach loop private string...
1
by: caldera | last post by:
Hi, I want to find the web user control in the datalist. I iterate the datalist using foreach statement in the DataListItem and in thi DataListItem I iterate all Controls objects but I can't find...
2
by: John Dalberg | last post by:
In a traditional for loop, one can use the index (say i) and continue looping in another function and come back to original for loop (even though it's not good practice) Can the newer foreach...
1
by: Wilfried Mestdagh | last post by:
Hi, Is it possible to get the current loop index in a foreach block ? -- rgds, Wilfried http://www.mestdagh.biz
1
khalidbaloch
by: khalidbaloch | last post by:
hi every one, how are you folf , hope fine dear Friends i want to get values of multi-dimensional arrays using foreach loop and after that print out the html using an other while loop , i tried...
3
by: Akira | last post by:
I noticed that using foreach is much slower than using for-loop, so I want to change our current code from foreach to for-loop. But I can't figure out how. Could someone help me please? Current...
6
by: titan nyquist | last post by:
Can I step through a struct using foreach? I want a method that steps through a struct, and prints out the name/value of each member. Can it be done? The error I get when trying this is: ...
1
by: vit159 | last post by:
I have Data Recive it from stordProceder and i want to Get this data using foreach loop to equal it with local variable
1
by: Doug | last post by:
Hi, I have a collection of objects and I need to compare each item in the collection to see if it's a match on any or all of the others. I have stored my collection in an item like so: ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.