loop througth Literials using foreach!!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Islam Elkhayat

    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.GetStr ing("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 InvalidCastExce ption... How can i fix this??


  • DalePres

    #2
    Re: loop througth Literials using foreach!!

    You can see my reply to your post in the asp.net group.

    DalePres
    MCAD, MCDBA, MCSE.


    "Islam Elkhayat" <islamegy@yahoo .com> wrote in message
    news:Oseut7xDFH A.4072@TK2MSFTN GP10.phx.gbl...[color=blue]
    > 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.GetStr ing("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 InvalidCastExce ption... How can i fix this??
    >[/color]


    Comment

    Working...