Click here to Skip to main content
15,889,216 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionOracle 10g connectivity issue with .net 2.0 website hosted on win 2008 server Pin
abhi17_66-Nov-13 4:20
abhi17_66-Nov-13 4:20 
QuestionImplement Custom Membership Provider in n-tier architecture Pin
Member 103823785-Nov-13 11:56
Member 103823785-Nov-13 11:56 
QuestionPage_init with variable Pin
vkEE4-Nov-13 2:30
vkEE4-Nov-13 2:30 
AnswerRe: Page_init with variable Pin
Gopi Kishan Mariyala11-Nov-13 3:52
Gopi Kishan Mariyala11-Nov-13 3:52 
QuestionThe name '###' does not exist in the current context - error Pin
miss7864-Nov-13 0:47
miss7864-Nov-13 0:47 
AnswerRe: The name '###' does not exist in the current context - error Pin
Richard Deeming4-Nov-13 1:38
mveRichard Deeming4-Nov-13 1:38 
GeneralRe: The name '###' does not exist in the current context - error Pin
miss7864-Nov-13 3:38
miss7864-Nov-13 3:38 
GeneralRe: The name '###' does not exist in the current context - error Pin
Richard Deeming4-Nov-13 4:38
mveRichard Deeming4-Nov-13 4:38 
miss786 wrote:
$('#Button1').click(function () {

Since you're using a master page, the client ID of Button1 won't be "Button1"; it will be something similar to "ctl00$MainContent$Button1".

If you're using ASP.NET 4.0, you can set the button's ClientIDMode[^] to Static, which will make sure that the client ID matches the server ID. If you're using an earlier version of ASP.NET, you'll need to find the correct ID, or use a different selector to find the button.
ASP
<asp:Button ID="Button1" runat="server" Text="Search" ClientIDMode="Static" />


You'll need to do the same for the SearchText textbox, since you reference it by ID:
ASP
<asp:TextBox ID="SearchText" runat="server" ClientIDMode="Static" />


miss786 wrote:
$('#Button1').click(function () {
    $.ajax({
       ...
    });
})


You need to end the event handler function with return false;, otherwise the button will cause a post-back and the AJAX call won't run. You should also terminate the statement with a semi-colon.
JavaScript
$("#Button1").click(function(){
    $.ajax({
        ...
    });
    
    return false;
});



miss786 wrote:
data: "{name:'" + $("#SearchText").val() + "'}",


I'd strongly recommend using the built-in JSON.stringify[^] method to convert the parameters to a string. If you need to support IE7, you can use Douglas Crockford's JSON-js[^] script.
JavaScript
data: JSON.stringify({ name: $("#SearchText").val() }),




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: The name '###' does not exist in the current context - error Pin
miss7865-Nov-13 0:54
miss7865-Nov-13 0:54 
GeneralRe: The name '###' does not exist in the current context - error Pin
Richard Deeming5-Nov-13 1:17
mveRichard Deeming5-Nov-13 1:17 
GeneralRe: The name '###' does not exist in the current context - error Pin
miss7865-Nov-13 1:56
miss7865-Nov-13 1:56 
GeneralRe: The name '###' does not exist in the current context - error Pin
Richard Deeming5-Nov-13 2:04
mveRichard Deeming5-Nov-13 2:04 
GeneralRe: The name '###' does not exist in the current context - error Pin
miss7865-Nov-13 2:56
miss7865-Nov-13 2:56 
GeneralRe: The name '###' does not exist in the current context - error Pin
Richard Deeming5-Nov-13 3:13
mveRichard Deeming5-Nov-13 3:13 
GeneralRe: The name '###' does not exist in the current context - error Pin
miss7865-Nov-13 3:47
miss7865-Nov-13 3:47 
GeneralRe: The name '###' does not exist in the current context - error Pin
Richard Deeming5-Nov-13 4:14
mveRichard Deeming5-Nov-13 4:14 
GeneralRe: The name '###' does not exist in the current context - error Pin
miss7865-Nov-13 4:28
miss7865-Nov-13 4:28 
GeneralRe: The name '###' does not exist in the current context - error Pin
Richard Deeming5-Nov-13 4:34
mveRichard Deeming5-Nov-13 4:34 
GeneralRe: The name '###' does not exist in the current context - error Pin
miss78611-Nov-13 3:28
miss78611-Nov-13 3:28 
QuestionASP Buttons event not firing Pin
Blikkies3-Nov-13 19:18
professionalBlikkies3-Nov-13 19:18 
AnswerRe: ASP Buttons event not firing Pin
Joshua Omundson4-Nov-13 4:16
Joshua Omundson4-Nov-13 4:16 
GeneralRe: ASP Buttons event not firing Pin
Blikkies4-Nov-13 5:06
professionalBlikkies4-Nov-13 5:06 
GeneralRe: ASP Buttons event not firing Pin
Joshua Omundson5-Nov-13 12:28
Joshua Omundson5-Nov-13 12:28 
GeneralRe: ASP Buttons event not firing Pin
Blikkies5-Nov-13 21:00
professionalBlikkies5-Nov-13 21:00 
QuestionNeeds help for DirectoryEntry.Invoke ("ChangePassword","Old_Pass","New_Pass") method Pin
tiyyob2-Nov-13 0:42
tiyyob2-Nov-13 0:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.