help with simple javascript: <asp:LinkButton OnclientClick="$find('<%=mpeup1.ClientID %>').hide();" ID="btnCancel" runat="server" CausesValidation="false">Cancel Edit</asp:LinkButton>

I have this app that has a Modapopup Extender control called "mpeup1" it is in a user control inside a formview control on a content page. So I use the clientID property and I simply want to close the ModalPopup on the client side with a simple button click. This is what I have but it doesn work because it always says error: "null is null and is nothing" or some l;ike that.

<asp:LinkButton OnclientClick="$find('<%=mpeup1.ClientID %>').hide();" ID="btnCancel" runat="server" CausesValidation="false">Cancel Edit</asp:LinkButton>

why is this not working? I am new to javascript

0
bcweed966
10/21/2008 2:16:10 AM
asp.net.client-side 24353 articles. 1 followers. Follow

2 Replies
798 Views

Similar Articles

[PageSpeed] 49

You can't put <%= ... %> blocks inside server tags. It won't work. It's better to set the handler in code. Try this:

<asp:LinkButton .... </asp:LinkButton>

<% btnCancel.OnClientClick = "$find('" + mpeup1.ClientID + "').hide();" %>

That is, you can use an inline code block instead of setting it in the control's tag. And of course, you can also set it in the code behind if yo wish to avoid the inline code block.


All that glitters is gold-
Only shooting stars break the mold.
0
HeartattacK
10/21/2008 2:42:15 AM

thank you.

what I did is this:

<asp:LinkButton ID="btnCancel" runat="server" CausesValidation="false">Cancel Edit</asp:LinkButton><br />

and in code behind:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If Not Me.IsPostBack Then

btnCancel.Attributes.Add("onclick", "$find('" + mpeup1.ClientID + "').hide();")

End If

End Sub

 

But I still get the error: "Null is null or not an object"

0
bcweed966
10/21/2008 2:52:32 AM
Reply:

Similar Artilces:

what's the different from "<page src="">" and "<page codeBehind="">"
what's the different from "<page src="">" and "<page codeBehind="">" Thank YOU how to make session' life longer? Thank You This very question was asked only 5 days ago. Searching the forums would have yielded the answer you require. However, see this thread. Steven BeyRecursion: see Recursion You can set a new value for the Session Timeout in your web.config file. Or, you can do it in a page through this property: Session.Timeout Note that if you choose the second method, the timeout will only be modified on this page,...

What is this for? "<label style=""display:none;"" for=""" & cboFieldType.ClientID.ToString & """>Type</label>"
I'm digging through the code of DNN and I found many ocurrences of this type of code: lblFieldType.Text = "<label style=""display:none;"" for=""" & cboFieldType.ClientID.ToString & """>Type</label>" What is that code for? The label is never displayed and I could not figure out what DDN uses it for. thank you This is for ADA compliance. The guidelines require that form elements have an associated label. This helps the text readers out with identifying the different parts of the form. BruceDynamic...

Regular Expression to remove "/", "\", "<", ">" and "="
Can anyone please show me the regular expression to reject a string ("<blue", "right>" etc.) which has the following expression in it: "/", "\", "<", ">" and "="  hi, It may Help u.. it is in Class file u may use this expressin in validation controls also. Regex objReg = new Regex(@"^[^,.?/\~|`;:'<>]*$", RegexOptions.Singleline); Regex objReg = new Regex(@"^[^,][^.][^?][^/][^\][^~|][^`][^;][^:][^'][[^<][^>]$", RegexOptions.IgnoreCase);Thanks &...

"<->" as "->" with automatic "is rw"
I like that arguments will be readonly by default. But when I look at my current code, I see that I would be typing " is rw" quite a lot, which in my opinion is too long for a thing that occurs very often. Every such situation in my code is a foreach loop. A thing that in Perl 6 will mostly be used with the pointy sub declaration syntax. If I'm not mistaken, <-> is still available. It communicates "bidirectional" and that is more or less the same as read/write access. I'm proposing for zip(@foos, @bars, @xyzzies) <-> $foo, $bar, $xyzz...

<img src='<%=PathPrefix + "Comm/Images/sp.gif" %>' height="8" width="20">- What is PathPrefix
<img src='<%=PathPrefix + "Comm/Images/sp.gif" %>' height="8" width="20"> What is PathPrefix ?-----------------------------------------------Please click Mark as Answer if this helped. PathPrefix is a public shared variable in the code behind file of this pageDo mark as answer if it helpsBest RegardsAli Sufyan ButtSoftware EngineerElectronic Solutions Pvt. Limited...

What if I remove <form id="form1" runat="server"></form>
If I am creating an aspx page, which does not need to be a form, i.e. no input is taken from the user, do I need to encapsulate the whole page with in  <form1 runat="server">   What are the implications of removing the form? I realize there will be no viewstate, and again, I won't be able to accept user input, but will everything else work as expected? It seems to be so far, I've just not seen ANY examples where the form tag has been removed. Thanks, Darragh You need the server-side form tag if you are going to have server-side controls on the form.RyanRyan Olshan...

"<table></table>" and "<frameset><frame></frame></frameset>" in perl/tk
Dear my friends... Anybody would be so kind telling me what is similar in perl/tk to arrange the location of a form written in perl/tk? I want a nice look for my perl/tk application. Somewhat like this below: 1. Name : <place to type-in> 2. Address : <place to type-in> 3. Telephone : <place to type-in> I have made the main menu of my application with "Menubutton". And I want if the user click on the menu that what the user see is only the aimed application displayed on the determined area (under the main menu) but the menu has no change in po...

<ypbp:CategoryTree id="categoryTree" runat="server"></ypbp:CategoryTree>
Hi All, I hope you can help a very confused beginner. I am writing a site that has a navigation tree configured from a database. I wanted to create a reusable piece of code that "draws" the navigation tree based on a request parameter that indicates to the code how to draw the tree. For example, the first time the page loads it will draw all the top level menu items only, and when a user clicks on one of those options it would draw all the top items and also the children of the item just clicked on etc... I want this to be reusable because I am writing an admin backend to the website as we...

can I delete <form id="form1" runat="server"> and </form>
Hi: Our website is written by using simple html code, one of the page has some virtual shopping cart code with <form> ....</form>, (for example here: http://www.centercoin.com/coin_supplies/coin_collecting_starter_set.htm ), if I have 10 products, I will have 10 of <from> ...</form> in this page, that is ok. Now, I am trying to redesign the website using asp.net2.0, I notice all the asp page will automatically create a <form id="form1" runat="server"> ...</form>, such as: <html xmlns="http://www.w3.org/19...

Why is "<MyControl ... />" different to "<MyControl ...> </MyControl>"
Hi I have made a CompositeControl and had it working fine. The sequence of events was: Page -> Page_Load(), MyControl -> CreateChildControls(). This was fine because I had to set a certain property in my control during page load before CreateChildControls was called. Anyway.... suddenly it all stopped working and it turned out that the sequence of events changed to MyControl -> CreateChildControls(), Page -> Page_Load(). This caused it to blow up because the property was not set. After a few hours of pulling my hair out and undoing all the recent changes I had made it turns out...

help with: BackColor='<%#iif((eval("timecode") = 1),"#993366","#993366") %>'
I have a panel and I wish to toggle its background color based on a databound value.  the expression returns all OK. Butit reutrns a string and it creates a casting error it returns "#993366" BackColor='<%#iif((eval("timecode") = 1),"#993366","#993366") %>' I know it is the declaration... something to do with the # in the <%# or ???   Hi That's the problem when you type it in there directly. It's a pain in the ass to debug/manage.Maybe you can take a look at this example. You add a function in your code-be...

Code Behind or "<script runat="server">...code...</script>"?
Hi, I've just started learning asp.net after a number of years with VB. A lot of the examples I've been researching have placed the VB code directly onto the .aspx web page with a "<script runat="server">...code...</script>" format rather than placing the code in a "code behind" .vb page. Is there any reason for this other than the fact that you can place all the relevant code onto one example? From a .Net Studio point of view, it's seems to be far easier to use Code Behind, as one can take advantage of the "Auto Complete" features th...

postback is deleting contents of <INPUT id="btnUpload" type="button" value="Upload" runat="server">
The <INPUT id="btnUpload" type="button" value="Upload" runat="server"> does not hold its value when there is a postBack to the server. Is there a way around this. Cheers What do you mean? The button text goes blank? Or do you mean it doesn't register it having a value a page reload after it being clicked? BrianBrian"Trust in the Lord and do what is good; dwell in the land and live securely. Take delight in the Lord, and He will give you your heart's desires" (Psalm 37: 3-4). I select the file i wish to upload, i ...

"Florian Ragwitz" <rafl@debian.org>, "Zefram" <zefram@fysh.org>, "Father Chrysostomos" <sprout@cpan.org>,
--0015175884b6a300aa04a8916f03 Content-Type: text/plain; charset=UTF-8 Howdy all. Bit of a slow week, as I didn't have net access for a couple of days. It was awful, and doesn't leave me with that much to report; But on the other hand, it was an awesome week - Midterm passed, the pad stuff got merged, and all the bugs in that started popping out. Fun : ) I'll follow up on that in another mail, so back to last week. With the pad merge, getting our and the error messages with scalar filehandles working done was only a few lines, which makes several TODO tests to pass;...

Difference between <%# Bind("") %> and <%# Eval("") %>
Occassionally, I will find myself using Bind and Eval interchangeable.  I am unclea or what is the exact difference.  Can someone shed some light?Thanks,X Friend, it is something like this Data-binding expressions are contained within <%# and %> delimiters and use the Eval and Bind functions. The Eval function is used to define one-way (read-only) binding. The Bind function is used for two-way (updatable) binding. In addition to calling Eval and Bind methods to perform data binding in a data-binding expression, you can call any publicly scoped code within the <%# and %...

Web resources about - help with simple javascript: <asp:LinkButton OnclientClick="$find('<%=mpeup1.ClientID %>').hide();" ID="btnCancel" runat="server" CausesValidation="false">Cancel Edit</asp:LinkButton> - asp.net.client-side

Resources last updated: 1/28/2016 7:30:46 PM