Expanding ClientID In An Event String?

Jan 22, 2010

I'm having a problem with <%= obj.ClientID %> expansion, in a .ascx user control.

I have a .js file, containing a javascript function:

function doSomething(objectId)

I have a .ascx file, with some html elements, and in one element's onclick= I want to call doSomething(), passing the ID of an element in that .ascx file, where the passed ID is of an element other than the one being clicked on, so I can't use "this.".

Maybe it'd be clearer with an example.

This works:

<script type="text/javascript">
function redirect()
doSomething('<%= top.ClientID %>');
<div id="top" runat="server">
<img src="..." alt="..." onclick="redirect();"/>

But this does not:

<div id="top" runat="server">
<img src="..." alt="..." onclick="doSomething('<%= top.ClientID %>');"/>

When I look at the source, I see that the <%=%> substitution has not happened, instead of "doSomething('ctl00_myControl_top');" I get "doSomething('<%=top.ClientID %>');"

For some reason, the script expansion happens in the former case, but not in the latter. The work-around, of course, is not acceptable because it will break if I include multiple copies of the control on a page - only one instance's "redirect()" function will be accessible.

View 1 Replies

Similar Messages:

Forms Data Controls :: RowDataBound Event Calculations-sum(field) Where ClientID=@clientID; Date + Int = Date?

Oct 26, 2010

I have a databound gridview that displays basic customer information. I have added a template field to the gridview, but I am having trouble with the coding for the RowDataBound event. I need to take the sum of all payments made by the customer in each row and store it in a variable for further calculation. Also, I need to take an integer value (say 30, representing 30 days) and add it to a date, and return a date.

View 14 Replies

Get ClientID If Textbox Name Is In String Variable?

Jun 30, 2010

I have written below code to check for blank value in my textbox but its generating compilation Error.

my code in javascript:

function checkTextboxNotFilled(txtbox) {
var txtb = document.getElementById("<%= " + txtbox + ".ClientID %>");
if (GetFormattedString(txtb.value) == "") {
return true ;
else {
return false ;


'string' does not contain a definition for 'ClientID' and no extension method 'ClientID' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)

I am calling it like this : checkTextboxNotFilled("MytextboxName")

View 2 Replies

Insert The ClientID Of A Div Into An OnClientClick Event?

May 26, 2010

In the XHTML for a page I have:-

<asp:Button ID="bookNowButton" runat="server" CssClass="bookNowButton"
OnClientClick="showHideLoggedInDiv('<%=bookingFormDiv.ClientID%>')" />

This breaks. I need the correct syntax or method to insert the bookingFormDiv.ClientID into the control.

View 2 Replies

Web Forms :: Rendered ClientID Is Different From Programmatically Retrieved ClientID

Sep 26, 2010

I get the ClientID of a control in ItemCreated event like this: 'ctrl0_spanLoader'

and when it is rendered like this (from view source of IE): 'CtlCategory1_ProfiledBasedSearchResult1_ListViewSearchResult_ctrl0_spanLoader'

This happens in Asp.Net 4 and I have no problems in Asp.Net 3.5.

How do I get the real clientID from ClientID property of my control? Is it a matter of configuration or anything else?

View 6 Replies

Treeview On Masterpage Not Expanding

Jan 17, 2010

Work on Asp.net VS08. In my master page i need to fill a treeview form database.I done it,i set the NavigationUrl value. When user click a leaf, then they see there wanted page. But then the MasterPage tree become expanded on root. I want the tree will not expanded and tree will the same as before click on leaf.

View 1 Replies

Web Forms :: Expanding DropDownList In IE6?

Mar 16, 2010

I've run into a problem with expanding a dropdownlist when the client is IE6...The screen allows users to optionally specify search selection criteria from dropdown listboxes. Since there may be a large amount of selection data, the usage of which is optional, the selection dropdown lists are only populated on demand (i.e., when the user clicks on the listbox -- I use the OnMousedown event). This improves the overall performance of the system since most users will not use the optional search data, saving time since that data is not retrieved from the Web Services calls and not added to the lists.

After loading the list, I fire the OnClick event to simulate the user's mouse click and display the list items that were just added. For IE7 or IE8, firing the onclick event works perfectly to expand the list. However, this does not work for IE6 -- it requires a second and third click on the listbox to display the list. Note: replacing the fireEvent("onclick") call with alert() works with IE6 (haven't tried it with IE7) -- after clicking on the dialog, the list is displayed correctly. That's not a realistic option for production, but may shed some light on a possible solution.


View 1 Replies

Creating A Dynamically Expanding Div Tag?

Mar 6, 2010

I need to create a dynamically expanding div tag, and I am not too sure how to go about it. Basically, I have a bulleted list control, which will be inserted inside a div tag. The div tag's height is set to about 70px. When more than 5 list items are added to the bulleted list control, I want the div tag's height to expand to show the rest of the items. What I was thinking is when there are more than 5 list items, to have a little linkbutton with the word more, and to click on this button, which will then expand on the div tag.

View 5 Replies

AJAX :: Accordion Not Expanding Or Collapsing?

Jun 23, 2010

i've made an Ajax accordion in a page. the problem is that the accordion is not collapsing or expandingthis is the code:


View 4 Replies

Expanding / Contracting Columns With Browser?

May 17, 2010

I'm trying to accomplish something like this [URL] , where you have images displayed in several columns, but as you resize your browser, columns will (dis)appear so to fit what you can see on the screen.

PS: Bear in mind that I'm quite a ASP.Net noob

View 2 Replies

Expanding Drop Down Area Above Instead Of Below With Javascript?

Nov 29, 2010

Ok so the story is my users need a multi-select dropdownlist, which doesn't exist in ASP.NET, so the simple solution I'm going with is I'm using listboxes with multiselect on and I start them off at size 1, and onmouseover I change the size to say 10, onmouseout sets it back to one. Simple enough and the users don't know the difference.

Now, my issue comes from the fact that since I have any number of controls on my web app, I've set these listboxes to higher z-index numbers than the other controls, which creates a problem: on my listboxes closer to the bottom of the page the list expands below and not above, and part of the listbox goes under the bottom of the page but since onmouseout resets the size of the listbox I can't scroll the page down.

Does anybody know what I need to set to make it expand up instead of down?

edit Also, some may ask "why don't you just rearrange the listbox to a higher position in the page," the reason this isn't a viable option is I have well over 40 controls on the page and it they're grouped cohesively, I didn't just randomly place them where they are.(ie. investment info in one section, account in another, suitability in another)

View 1 Replies

Treeview Control Not Expanding On Click?

May 6, 2010

I having an issue with the ASP.NET Treeview control. I create the treeview just fine but the nodes will not expand or collapse. I see there is a javascript error but it is for line 1 character 0 of the webpage, there is nothing at line 1 character 0.

I am using the ASP:Treeview control in conjunction with the Telerik controls, but I'm not sure if that is an issue.

I saw there was a similar question here but the answer is not pertinent to my site. Has anyone run into this issue before? I've tried searching Google and tried a number of proposed solutions but so far none have worked.

View 2 Replies

TreeView Nodes Not Expanding And Collapsing?

Feb 8, 2010

I have a TreeView menu populated from a SiteMapDataSource. The TreeView defaults to all nodes expanded, but the normal client side expand/collapse behaviour for the nodes is not working. I get one Javascript error in my Firebug console, being:

TreeView_ToggleNode is not defined

What could be causing this?

View 1 Replies

MVC :: .net Mvc Grid Control - Expanding Row To Show Other Row?

Mar 9, 2010

I have a grid with Data in that grid first column has so what I am doign is if user clicks + sign I am expanding row to show other row,I need to have a button in the page.. once I click that I need to expand all the accounts. how to do this using asp.net MVC ?

View 5 Replies

Web Forms :: Bug Of 4 Controls ClientID?

Jan 16, 2011

found that when I get the Request.Form("__EVENTTARGET") on a postback and compare it to Control.ClientId it is not equals.


My Code:


This line "If ctrlName = DropDownList_CantidadAcompanhantes.ClientID Then" is never equals.

View 4 Replies

Way To Get ClientIDMode And ClientID Property On 3.5?

Jun 4, 2010

I would like to have the brand new ClientIDMode and the ClientID property on ASP.NET 3.5 controls, there is any way I can achieve that?I was thinking in replacing the default control compiler, this is possible or there is many changes to make this behavior available?

View 1 Replies

C# - Get ClientID Of A Parameter On An ASP Site?

Jul 19, 2010

I have a parameter for a method, that should be a string and I can't come up with how to <% *.ClientID %> to the thing as a variable like that. Since its a variable i can't wrap it in quotes since it will be taken literally and when I use the parameter like a variable (as you're supposed to) i get an ASP error saying it doesn't exist in the context (reading it literally).Code Sample

function next(currentControl, maxLength, nextControl) {
if (document.getElementById( currentControl<%=.ClientID %>).value.length >= maxLength) {
document.getElementById( nextControl<%=.ClientID %>).focus();


View 2 Replies

ClientId Is Different In Localhost And The Webserver?

Jan 28, 2011

I am facing a new kinda probs, i am using the jquery to fill the state dorpdown on the change of country dropdown and the code of the jquery is on a js file so i bind the static client id like ct100_ddlCountry, this is working properly on the localhost but when i host this website to web server it not working because the client generating on the server is _ct100_ddlColuntry.

View 3 Replies

Print A ClientID In A Webpage?

Feb 17, 2011

How do I print an ASP clientID in a web page?

<td class="ColDatos" colspan="1"><asp:TextBox ID="FECHA_APLICACION" runat="server" Width="85%"></asp:TextBox>
<a href="javascript:alert('<%=FECHA_APLICACION.clientID %>')">
mostrar fecha

update: i need do print in the asp side, no code behind side(onload,oninit,etc)( I'm not familiar with asp terms)

View 3 Replies

JQuery :: Expanding Accordion_container On Navigation From Another View

Feb 25, 2011

I have ContentView which has 'Table of Contents' and another view (DescriptionView) which has the total description of these contents. Each content description in DescriptionView is in different sections and I have implemented accordion to manage this.


When I click on each content in ContentView I navigate to that particular section in the DescriptionView by the of the anchor tag which i specify in the url. My issue is I am not able to open that section which will be hided using accordion. Hope am successful in explaining my query.

View 1 Replies

AJAX :: Programmatically Expanding Accordion Pane

Jul 22, 2010

I've got a databound accordion. It's on a page that is passed an id (via querystring) of the pane to open. I can get the id and identify which pane to open no problem. I just can't open it programmatically. I've tried every combination of everything I can find using my good friend google. I've tried setting in the PreRenderComplete (after all the databinding's done, when I can tell which pane contains the id I want to expand) using accordionid.SelectedIndex() = int.

I've tried $get(clientid).set_SelectedIndex() and $get(accordionid).set_SelectedIndex(). I've tried $find(clientid).set_SelectedIndex() and $find(accordionid).set_SelectedIndex(). I've tried $get(clientid_AccordionExtender).set_SelectedIndex() and $get(accordionid_AccordionExtender).set_SelectedIndex().

View 3 Replies

Css - Prevent A Menu From Expanding Over Adjacent Content?

Nov 25, 2010

I have a two column layout, with a vertically oriented ASP.NET menu control in a narrow left column, and info related to the selected menu item in a wide right column:

<div class="span-4">
<asp:Menu ID="categoryMenu" runat="server" Orientation="Vertical">
<div id="product-grid-pane" class="span-12 last">
<asp:GridView ID="productGrid" runat="server" AutoGenerateColumns="false" ShowHeader="false" Width="100%">

If a menu item contains long text, the menu simply expands over the grid. How can I prevent this? I might need two answers here: the pure CSS one, which would be very nice if the menu control rendered nice, simple UL elements, but it seems to prefer an impenetrable table based structure I may need additional help styling properly.

View 1 Replies

Web Forms :: How To Add Current ClientID To Table

Oct 5, 2010

I am trying to create a listing for a ticket company. When the user(client) adds a new ticket to the listing, all the ticket info is saved into the database table, but I can't figure out how to get their clientID in the table with that post. For example, I have event, date, venue, row, section etc...all this info gets stored, but I need to have the clientID stored also, so the gridview can show the post when the client logs in/out from the app. Right now the only way the clientID is in the DB is because I manually put it there for development reasons. But, when the client adds a new item to their listings, it does not show until I put the ID in myself. I need the ID to insert in the CID column at the same time the rest of the info is stored.

View 5 Replies

.net 4 Framework Getelementbyid For Javascript Without Clientid?

Aug 20, 2010

I thought I heard we would be able to get the value of an asp:textbox by id with javascript in the .net 4 framework? was I mistaken? if not does anyone know the syntax?

View 1 Replies

AJAX :: Get ClientID Of Control Using JQuery

Dec 14, 2013

function verifyEmail() {
var pageUrl = '<%=ResolveUrl("~/UserInterface/StaffPortal/StaffRegister.aspx")%>'
var verifyEmail = '{verifyEmail:"' + $('#<%=Text_email.ClientID%>').val() + '"}';

Above function is a little part of whole actual function where I'm using json to store data of textbox in variable and pass as a parameter in query.

as seen in above funtion I'm using 


How can i pass this as parameter and use the same function for more than one textboxes? 

function verifyEmail(idd) {
var pageUrl = '<%=ResolveUrl("~/UserInterface/StaffPortal/StaffRegister.aspx")%>'
var verifyEmail = '{verifyEmail:"' + $('#'+idd+'').val() + '"}';

I've tried above code. I've called function using verifyEmail('<%=Text_email.ClientID%>'); but it is not working.

When I alert idd then it prompts <%=Text_email.ClientID%> but when i pass variable idd in $('#+idd+') it doesnt work?

View 1 Replies

Copyrights 2005-15 www.BigResource.com, All rights reserved