Shortening of syntax

Discussion in 'ASP .Net' started by =?Utf-8?B?c3RldmVuIHNjYWlmZQ==?=, Jul 12, 2006.

  1. Hi is it possible to shorten the syntax of the following.

    Ctype(Page.Controls.Item(1).Controls.Item(Page.Controls.Item(1).Controls.IndexOf(pnl)).Controls.Item(Page.Controls.Item(1).Controls.Item _

    (Page.Controls.Item(1).Controls.IndexOf(pnl)).Controls.IndexOf(Page.Controls.Item(1).Controls.Item _

    (Page.Controls.Item(1).Controls.IndexOf(pnl)).Controls.Item(Page.Controls.Item(1).Controls.Item _

    (Page.Controls.Item(1).Controls.IndexOf(pnl)).Controls.IndexOf(frmDict.myformctrls.Item("txtQuantity1").txtCont)))), HtmlInputText).Value

    I dont want to keep cutting and pasting that, surely i can shorten it. I
    have tried

    with
    Page.Controls.Item(1).Controls.Item(Page.Controls.Item(1).Controls.IndexOf(pnl)).Controls.Item(Page.Controls.Item(1).Controls.Item _

    (Page.Controls.Item(1).Controls.IndexOf(pnl)).Controls.IndexOf(Page.Controls.Item(1).Controls.Item _

    (Page.Controls.Item(1).Controls.IndexOf(pnl)).Controls.Item(Page.Controls.Item(1).Controls.Item _
    (Page.Controls.Item(1).Controls.IndexOf(pnl))

    But i get the error value of type 'system.web.ui.control' cannot be
    converted to integer.

    TIA
     
    =?Utf-8?B?c3RldmVuIHNjYWlmZQ==?=, Jul 12, 2006
    #1
    1. Advertising

  2. nevermind i found an alternative approach. I can just modify my object in
    the sub routine in the class and set the properties in the page when
    processing returns.

    "steven scaife" wrote:

    > Hi is it possible to shorten the syntax of the following.
    >
    > Ctype(Page.Controls.Item(1).Controls.Item(Page.Controls.Item(1).Controls.IndexOf(pnl)).Controls.Item(Page.Controls.Item(1).Controls.Item _
    >
    > (Page.Controls.Item(1).Controls.IndexOf(pnl)).Controls.IndexOf(Page.Controls.Item(1).Controls.Item _
    >
    > (Page.Controls.Item(1).Controls.IndexOf(pnl)).Controls.Item(Page.Controls.Item(1).Controls.Item _
    >
    > (Page.Controls.Item(1).Controls.IndexOf(pnl)).Controls.IndexOf(frmDict.myformctrls.Item("txtQuantity1").txtCont)))), HtmlInputText).Value
    >
    > I dont want to keep cutting and pasting that, surely i can shorten it. I
    > have tried
    >
    > with
    > Page.Controls.Item(1).Controls.Item(Page.Controls.Item(1).Controls.IndexOf(pnl)).Controls.Item(Page.Controls.Item(1).Controls.Item _
    >
    > (Page.Controls.Item(1).Controls.IndexOf(pnl)).Controls.IndexOf(Page.Controls.Item(1).Controls.Item _
    >
    > (Page.Controls.Item(1).Controls.IndexOf(pnl)).Controls.Item(Page.Controls.Item(1).Controls.Item _
    > (Page.Controls.Item(1).Controls.IndexOf(pnl))
    >
    > But i get the error value of type 'system.web.ui.control' cannot be
    > converted to integer.
    >
    > TIA
     
    =?Utf-8?B?c3RldmVuIHNjYWlmZQ==?=, Jul 12, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eli Bendersky
    Replies:
    9
    Views:
    693
    Allan Herriman
    Apr 7, 2006
  2. Littlefield, Tyler

    Dynamic URL shortening

    Littlefield, Tyler, Jun 15, 2011, in forum: Python
    Replies:
    0
    Views:
    548
    Littlefield, Tyler
    Jun 15, 2011
  3. Alexey Verkhovsky

    How to disable stack-trace shortening?

    Alexey Verkhovsky, Oct 10, 2004, in forum: Ruby
    Replies:
    1
    Views:
    251
    Brian Candler
    Oct 10, 2004
  4. Zouplaz

    RoR : Shortening this code

    Zouplaz, Oct 6, 2006, in forum: Ruby
    Replies:
    7
    Views:
    119
    eden li
    Oct 8, 2006
  5. Zouplaz

    Shortening this expression ?

    Zouplaz, Nov 24, 2006, in forum: Ruby
    Replies:
    9
    Views:
    108
    William James
    Nov 25, 2006
Loading...

Share This Page