.net 1.1, using multiple textboxes and dropdown boxes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?bWF2cmljazEwMQ==?=

    .net 1.1, using multiple textboxes and dropdown boxes

    Hi,

    I have a webform which has 4 panels.

    Each panel would have about 20 textboxes and dropdown boxes. I have named
    the controls like
    Panel1:
    _textboxP1T1;
    _textboxP1T2;
    ......
    similarly
    _listP1L1;

    so goes for other Panels, 2, 3 and 4.

    On page submit, I get the values in those textboxes like this....

    for (int i=1;i<=20;i++)
    {

    Textbox tempBox = (TextBox) Page.FindContro l("_textboxP1 T" +
    i.ToString());
    if (tempBox != null)
    {
    .........
    }
    }

    My question is, is it the only way? Is there a way similar to 'eval' in
    Javascript?

    so I can just grab the value of the text box like

    eval("_textboxP 1T" + i.ToString).Tex t....

    Any one???




  • =?Utf-8?B?bWF2cmljazEwMQ==?=

    #2
    RE: .net 1.1, using multiple textboxes and dropdown boxes

    anyone???

    "mavrick101 " wrote:
    Hi,
    >
    I have a webform which has 4 panels.
    >
    Each panel would have about 20 textboxes and dropdown boxes. I have named
    the controls like
    Panel1:
    _textboxP1T1;
    _textboxP1T2;
    .....
    similarly
    _listP1L1;
    >
    so goes for other Panels, 2, 3 and 4.
    >
    On page submit, I get the values in those textboxes like this....
    >
    for (int i=1;i<=20;i++)
    {
    >
    Textbox tempBox = (TextBox) Page.FindContro l("_textboxP1 T" +
    i.ToString());
    if (tempBox != null)
    {
    .........
    }
    }
    >
    My question is, is it the only way? Is there a way similar to 'eval' in
    Javascript?
    >
    so I can just grab the value of the text box like
    >
    eval("_textboxP 1T" + i.ToString).Tex t....
    >
    Any one???
    >
    >
    >
    >

    Comment

    • bruce barker

      #3
      Re: .net 1.1, using multiple textboxes and dropdown boxes

      no. c# does not have the equivalent (only the new dynamic .net
      languages, python, ruby and javascript have it). you could use the
      codedom to generate the code at runtime but it would not be as clean as
      your code. you could write a function to encapsulate the find and cast.


      -- bruce (sqlwork.com)

      mavrick101 wrote:
      anyone???
      >
      "mavrick101 " wrote:
      >
      >Hi,
      >>
      >I have a webform which has 4 panels.
      >>
      >Each panel would have about 20 textboxes and dropdown boxes. I have named
      >the controls like
      >Panel1:
      >_textboxP1T1 ;
      >_textboxP1T2 ;
      >.....
      >similarly
      >_listP1L1;
      >>
      >so goes for other Panels, 2, 3 and 4.
      >>
      >On page submit, I get the values in those textboxes like this....
      >>
      >for (int i=1;i<=20;i++)
      >{
      >>
      > Textbox tempBox = (TextBox) Page.FindContro l("_textboxP1 T" +
      >i.ToString() );
      > if (tempBox != null)
      > {
      > .........
      > }
      >}
      >>
      >My question is, is it the only way? Is there a way similar to 'eval' in
      >Javascript?
      >>
      >so I can just grab the value of the text box like
      >>
      >eval("_textbox P1T" + i.ToString).Tex t....
      >>
      >Any one???
      >>
      >>
      >>
      >>

      Comment

      Working...