Search Results

Search found 11 results on 1 pages for 'dopostback'.

Page 1/1 | 1 

  • ASP.NET Call Another Element's DoPostBack Function

    - by blu
    I have an ASP.NET control that has an onclick event handler rendered inline on the element. I would like to call that function and have it raise the target control's server side event handler. <asp:CheckBox ID="Foo" runat="server" AutoPostBack="true" Text="Foo" /> <a href="#" onclick="javascript:setTimeout('__doPostBack(\'Foo\',\'\')', 0)">Test </a> I created the checkbox, looked at the rendered function on the field, and then copied that into the onclick on the anchor element. The anchor will raise a postback, but the event handler for the check box is not raised. protected override void OnLoad(EventArgs e) { // fires for checkbox // fires for anchor (the anchor does cause a postback) } void Foo_CheckedChanged(object sender, EventArgs e) { // fires for checkbox // does not fire for anchor } protected override void OnInit(EventArgs e) { this.Foo.CheckedChanged += new EventHandler(Foo_CheckedChanged); } Is it possible to do this?

    Read the article

  • Is it possible that __doPostBack() would ever send a GET request?

    - by Galilyou
    I'm having a problem with telerik RadGrid, I want to enable multiple row selection. I also want to go to the server whenever a row is selected or deselected. I created a javascript function to handle the Grid's client side events (OnRowSelected, and OnRowDeSelected). The functions look like this: function onOperationRowSelected(sender, eventArgs) { __doPostBack("<%=myControl.ClientID %>", "rowSelected:" + eventArgs.get_itemIndexHierarchical()); } The other function is very similar, the only difference is that it sends the string "rowDeselcted" instead of "rowSelected". On Page_Load I check to see if the request is a Post request using "IsPostBack" and if so, I check to see if it's a rowSelected or rowdeselected. My problem is when I select a first raw on my grid, a Post request happens (which is expected), however, when I select the second row, a GET request is issued, which (obviously) will result in IsPostBack returning false. What am I missing here?

    Read the article

  • prevent _doPostBack getting rendered in button markup

    - by Christo Fur
    Hi Is it possible to prevent the _doPostBack() call getting rendered on a button? I would like add some custom logic prior to calling the postback. I have added an onClick event to the button e.g. <button id="manualSubmit" runat="server" class="manual-submit" onclick="$('#jeweller-form').hide();" /> However, this just gets rendered inline before the _doPostBack() But the postback gets fired before the jQueryHide takes place I would like to call my own JS function then manually trigger the postback any ideas?

    Read the article

  • how to: get rid of __doPostBack from link buttons?

    - by b0x0rz
    for example: this code: <asp:LinkButton ID="SignInLinkButton" runat="server" CssClass="SignInLinkButton" TabIndex="3" OnClick="AuthorizeUser">SignIn</asp:LinkButton> shows this as link in status bar: javascript:__doPostBack('ctl00$ctl00$GlobalPageContentPlaceHolder$ManagePageContentPlaceHolder$SignInLinkButton','') is there a chance o get rid of this ugliness? or is there a better way of doing this, that does not generate this insanity? i searched, but did not find an answer, so links are also cool. thnx

    Read the article

  • How do you clear a CustomValidator Error on a Button click event?

    - by George
    I have a composite User control for entering dates: The CustomValidator will include server sided validation code. I would like the error message to be cleared via client sided script if the user alters teh date value in any way. To do this, I included the following code to hook up the two drop downs and the year text box to the validation control: <script type="text/javascript"> ValidatorHookupControlID("<%= ddlMonth.ClientID%>", document.getElementById("<%= CustomValidator1.ClientID%>")); ValidatorHookupControlID("<%= ddlDate.ClientID%>", document.getElementById("<%= CustomValidator1.ClientID%>")); ValidatorHookupControlID("<%= txtYear.ClientID%>", document.getElementById("<%= CustomValidator1.ClientID%>")); </script> However, I would also like the Validation error to be cleared when the user clicks the clear button. When the user clicks the Clear button, the other 3 controls are reset. To avoid a Post back, the Clear button is a regular HTML button with an OnClick event that resets the 3 controls. Unfortunately, the ValidatorHookupControlID method does not seem to work on HTML controls, so I thought to change the HTML Button to an ASP button and to Hookup to that control instead. However, I cannot seem to eliminate the Postback functionality associated by default with the ASP button control. I tried to set the UseSubmitBehavior to False, but it still submits. I tried to return false in my btnClear_OnClick client code, but the code sent to the browser included a DoPostback call after my call. btnClear.Attributes.Add("onClick", "btnClear_OnClick();") Instead of adding OnClick code, I tried overwriting it, but the DoPostBack code was still included in the final code that was sent to the browser. What do I have to do to get the Clear button to clear the CustomValidator error when clicked and avoid a postback? btnClear.Attributes.Item("onClick") = "btnClear_OnClick();"

    Read the article

  • Wasteful Ajax Page Loading

    - by Matt Dawdy
    I've started a new job, and the portion of the project I'm working has a very odd structure. Every pages is a .Net aspx page, and it loads just fine, but nothing is really done at load time. Everything is really loaded from a jquery document.onready handler. What is even more...interesting...is that the onready handler calls some ajax calls that drop entire .aspx pages into divs on the page, but first it strips out several parts of the the returned page. This is the "magic" script the previous programmer ran on all the returned html from his ajax calls: function CleanupResponseText(responseText, uniqueName) { responseText = responseText.replace("theForm.submit();", "SubmitSubForm(theForm, $(theForm).parent());"); responseText = responseText.replace(new RegExp("theForm", "g"), uniqueName); responseText = responseText.replace(new RegExp("doPostBack", "g"), "doPostBack" + uniqueName); return responseText; } He then intercepts any kind of form postback and runs his own form submission function: function SubmitSubForm(form, container) { //ShowLoading(container); $(form).ajaxSubmit( { url: $(form).attr("action"), success: function(responseText) { $(container).html(CleanupResponseText(responseText, form.id)); $("form", container).css("margin-top", "0").css("padding-top", "0"); //HideLoading(container); } } ); } Am I way offbase in thinking that this is less than optimal? I mean, how does a browser take out the html and head and other tags that don't have anything to do with what you are really trying to drop into that div? Also, he's returning things like asp:gridview controls, and the associate viewstate, which can be quite large if his dataset is big. Has anyone seen this before?

    Read the article

  • ASP.net: Radio Button Not Maintaining Selection After Postback, Inside DIV/Thickbox

    - by jlrolin
    I have a set of radio buttons inside a hidden DIV. <div id="reports" style="display:none;"> <center> <br /> <table cellpadding="4" cellspacing="0"> <tr> <td class="label"> Report Type::&nbsp; </td> <td class="value"> <asp:RadioButton ID="rbReportTypeCust" runat="server" Text="By Customer" Enabled="True" Checked="True" GroupName="rbType" />&nbsp;<asp:RadioButton ID="rbReportTypeProg" runat="server" Text="By Program" Enabled="True" GroupName="rbType" /> </td> </tr> <tr> <td class="label"> Customer:&nbsp; </td> <td class="value"> <asp:DropDownList ID="ddlCustomer" runat="server" /> </td> </tr> <tr> <td class="label"> Program Group::&nbsp; </td> <td class="value"> <asp:DropDownList ID="ddlProgramGroups" runat="server" /> </td> </tr> </table> <br /> <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClientClick="doPostBack(this);" /> </center> </div> The DIV is displayed using Thickbox as a modal popup. The doPostback javascript function posts the button click back, and hits btnSubmit_Click where a report is then generated. If I see if a radio button is checked, it's always rbReportTypeCust.checked = True, never the rbReportTypeProg.checked = True even if I click it. Any suggestions?

    Read the article

  • ajaxSubmit and Other Code. Can someone help me determine what this code is doing?

    - by Matt Dawdy
    I've inherited some code that I need to debug. It isn't working at present. My task is to get it to work. No other requirements have been given to me. No, this isn't homework, this is a maintenance nightmare job. ASP.Net (framework 3.5), C#, jQury 1.4.2. This project makes heavy use of jQuery and AJAX. There is a drop down on a page that, when an item is chosen, is supposed to add that item (it's a user) to an object in the database. To accomplish this, the previous programmer first, on page load, dynamically loads the entire page through AJAX. To do this, he's got 5 div's, and each one is loaded from a jquery call to a different full page in the website. Somehow, the HTML and BODY and all the other stuff is stripped out and the contents of the div are loaded with the content of the aspx page. Which seems incredibly wrong to me since it relies on the browser to magically strip out html, head, body, form tags and merge with the existing html head body form tags. Also, as the "content" page is returned as a string, the previous programmer has this code running on it before it is appended to the div: function CleanupResponseText(responseText, uniqueName) { responseText = responseText.replace("theForm.submit();", "SubmitSubForm(theForm, $(theForm).parent());"); responseText = responseText.replace(new RegExp("theForm", "g"), uniqueName); responseText = responseText.replace(new RegExp("doPostBack", "g"), "doPostBack" + uniqueName); return responseText; } When the dropdown itself fires it's onchange event, here is the code that gets fired: function SubmitSubForm(form, container) { //ShowLoading(container); $(form).ajaxSubmit( { url: $(form).attr("action"), success: function(responseText) { $(container).html(CleanupResponseText(responseText, form.id)); $("form", container).css("margin-top", "0").css("padding-top", "0"); //HideLoading(container); } } ); } This blows up in IE, with the message that "Microsoft JScript runtime error: Object doesn't support this property or method" -- which, I think, has to be that $(form).ajaxSubmit method doesn't exist. What is this code really trying to do? I am so turned around right now that I think my only option is to scrap everything and start over. But I'd rather not do that unless necessary. Is this code good? Is it working against .Net, and is that why we are having issues?

    Read the article

  • Ajax and Brower Navigation for Back/Forward

    - by David Rodecker
    I am using a ASP.net form with custom onclick mouse events to modify data values. Upon clicking and updating the values, one div section of the form performs a postback. onclick="__doPostBack('ctl01$phCon1$gridReports','sel1')" This is working well, however when the browser BACK option is selected, the browser opens goes through the history of the DIV ajax/onclick actions prior to going back to the prior URL. I suspect that this may be due to the doPostBack being treated as a browsing operation. Is there a means to perform the necessary ASP.net code events to make the page work, but not have the action stored in the browser history?

    Read the article

  • .net user control event handler lost on postback

    - by user154008
    I have a menu usercontrol called LeftMenu that has a bulletedlist of linkitems. It's on the ascx page as such: <asp:BulletedList ID="PublisherList" DisplayMode="LinkButton" OnClick="PublisherList_Click" cssClass="Menu" runat="server"></asp:BulletedList> I databind the list in the page_load under if(!isPostBack) I'm having an issue on a page that loads the control. When the page first loads, the event handler fires. However, when the page posts back it no longer fires and in IE8, when I'm debugging, I get "Microsoft JScript runtime error: Object expected" in Visual Studio pointing at "doPostBack('LeftMenu$PublisherList','0')." In FF I don't get the error, but nothing happens. I'm **not loading the control dynamically, it's loaded on the aspx page using: <%@ Register TagPrefix="Standards" TagName="LeftMenu" Src="LeftMenu.ascx" %> <Standards:LeftMenu ID="LeftMenu" runat="server"/> Any ideas of where I'm losing the event handler? I just realized this is happening on another user control I have as well. A text box and a button and I'm using the default button to make sure pressing the enter key uses that button. .Net converts that in the html to: <div id="SearchBarInclude_SearchBar" onkeypress="javascript:return WebForm_FireDefaultButton(event, 'SearchBarInclude_QuickSearchButton')"> so as soon as i enter a key in the box I get a javascript error at the line saying "object expected." It seems like the two issues are related. Edit Again: I think I need to clarify. It's not that I'm clicking on the menu item and it can't find the selected item on postback. I have this search page with the left navigation on it and then the main content of the page is something that causes a postback. Everything is fine with this postback. Once that page has been posted back, now if I click on the bulleted list in the left navigation I get a javascript error and it fails. The page_init for the LeftMenu control is never called.

    Read the article

1