Connecting Tech Pros Worldwide Help | Site Map

javascript string manipulation

=?Utf-8?B?cm9kY2hhcg==?=
Guest
 
Posts: n/a
#1: Apr 9 '08
hey all,
what's the best way to extract info from the following string:

controlvalueid_ctl02_DrpX

i need "_Drp" and everything to the right of it.

thanks,
rodchar
Mark Rae [MVP]
Guest
 
Posts: n/a
#2: Apr 9 '08

re: javascript string manipulation


"rodchar" <rodchar@discussions.microsoft.comwrote in message
news:FBF2B345-6C45-4646-A394-2551D929998A@microsoft.com...
Quote:
what's the best way to extract info from the following string:
>
controlvalueid_ctl02_DrpX
>
i need "_Drp" and everything to the right of it.
Are you trying to find the server-side control ID, as opposed to the
"munged" client-side control ID...?


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

=?Utf-8?B?YnJ1Y2UgYmFya2Vy?=
Guest
 
Posts: n/a
#3: Apr 9 '08

re: javascript string manipulation



var s = 'controlvalueid_ctl02_DrpX'.match(/_Drp.*$/)

-- bruce (sqlwork.com)


"rodchar" wrote:
Quote:
hey all,
what's the best way to extract info from the following string:
>
controlvalueid_ctl02_DrpX
>
i need "_Drp" and everything to the right of it.
>
thanks,
rodchar
=?Utf-8?B?cm9kY2hhcg==?=
Guest
 
Posts: n/a
#4: Apr 9 '08

re: javascript string manipulation


yes Mark but this is the only way i know to get it thru javascript. is there
another way?

"Mark Rae [MVP]" wrote:
Quote:
"rodchar" <rodchar@discussions.microsoft.comwrote in message
news:FBF2B345-6C45-4646-A394-2551D929998A@microsoft.com...
>
Quote:
what's the best way to extract info from the following string:

controlvalueid_ctl02_DrpX

i need "_Drp" and everything to the right of it.
>
Are you trying to find the server-side control ID, as opposed to the
"munged" client-side control ID...?
>
>
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
>
>
George Ter-Saakov
Guest
 
Posts: n/a
#5: Apr 9 '08

re: javascript string manipulation


use
DrpX.ClientID
or sometimes
DrpX.UniqueID

depending on what you need name or id of the control...


George.


"rodchar" <rodchar@discussions.microsoft.comwrote in message
news:B0DCBA34-1F4D-4BD1-BA5E-4B82400ADA02@microsoft.com...
Quote:
yes Mark but this is the only way i know to get it thru javascript. is
there
another way?
>
"Mark Rae [MVP]" wrote:
>
Quote:
>"rodchar" <rodchar@discussions.microsoft.comwrote in message
>news:FBF2B345-6C45-4646-A394-2551D929998A@microsoft.com...
>>
Quote:
what's the best way to extract info from the following string:
>
controlvalueid_ctl02_DrpX
>
i need "_Drp" and everything to the right of it.
>>
>Are you trying to find the server-side control ID, as opposed to the
>"munged" client-side control ID...?
>>
>>
>--
>Mark Rae
>ASP.NET MVP
>http://www.markrae.net
>>
>>

=?Utf-8?B?cm9kY2hhcg==?=
Guest
 
Posts: n/a
#6: Apr 9 '08

re: javascript string manipulation


but that's on the server-side right? because i'm trying to get to the element
in javascript.

"George Ter-Saakov" wrote:
Quote:
use
DrpX.ClientID
or sometimes
DrpX.UniqueID
>
depending on what you need name or id of the control...
>
>
George.
>
>
"rodchar" <rodchar@discussions.microsoft.comwrote in message
news:B0DCBA34-1F4D-4BD1-BA5E-4B82400ADA02@microsoft.com...
Quote:
yes Mark but this is the only way i know to get it thru javascript. is
there
another way?

"Mark Rae [MVP]" wrote:
Quote:
"rodchar" <rodchar@discussions.microsoft.comwrote in message
news:FBF2B345-6C45-4646-A394-2551D929998A@microsoft.com...
>
what's the best way to extract info from the following string:

controlvalueid_ctl02_DrpX

i need "_Drp" and everything to the right of it.
>
Are you trying to find the server-side control ID, as opposed to the
"munged" client-side control ID...?
>
>
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
>
>
>
>
>
=?Utf-8?B?cm9kY2hhcg==?=
Guest
 
Posts: n/a
#7: Apr 10 '08

re: javascript string manipulation


thanks for this one,
rod.

"bruce barker" wrote:
Quote:
>
var s = 'controlvalueid_ctl02_DrpX'.match(/_Drp.*$/)
>
-- bruce (sqlwork.com)
>
>
"rodchar" wrote:
>
Quote:
hey all,
what's the best way to extract info from the following string:

controlvalueid_ctl02_DrpX

i need "_Drp" and everything to the right of it.

thanks,
rodchar
Closed Thread