OnItemDataBound registers Link Buttons in List View to Update Panels Script Manager, However, They only Work...












0















I have an update panel with ChildrenAsTriggers set to true so there is no actual script manager defined on the ascx file or in the code behind file.



Inside there is a list view, whos OnItemDataBound calls this function:



// ------------------------------------------------
// Register Update Panel Async Postback Triggers for View Order Buttons
// ------------------------------------------------
protected void orderListView_ItemDataBound(object sender, ListViewItemEventArgs e)
{
var scriptManager = ScriptManager.GetCurrent(Page);
LinkButton lbOne = e.Item.FindControl("viewOrder") as LinkButton;
scriptManager.RegisterAsyncPostBackControl(lbOne); // ToolkitScriptManager
}


This is supposed to take the LinkButton inside the List View, and register the buttons so a hard refresh does not occur when it is clicked.



For some reason, it only works on the first click of the link button in the list view. If I click it again, it does a hard refresh and buttons no longer seemed to be bound.



Any suggestions on why this may be?










share|improve this question

























  • If I put an UpdatePanel on the page without a SciptManager I get the error "The control with ID 'UpdatePanel1' requires a ScriptManager on the page". How did you get around this?

    – VDWWD
    Nov 14 '18 at 20:08











  • I believe its because ChildrenAsTriggers="true" is flagged on the update panel after runat="server"

    – Isaac Byrne
    Nov 14 '18 at 20:10











  • Noe that does not matter. Are you perhaps using a Master page? And could have that page the ScriptManager?

    – VDWWD
    Nov 14 '18 at 20:12











  • Sorry, I misspoke, this is likely the case as it's an ascx file not an aspx file.

    – Isaac Byrne
    Nov 14 '18 at 20:13











  • Ah, then the SciptManager is on the page itself. But that does not explain your issue. Everything in an UpdatePanel automatically does a Async PostBack. So there should be no need to register that Control with ScriptManager.RegisterAsyncPostBackControl(lbOne). I cannot reproduce the issue...

    – VDWWD
    Nov 14 '18 at 20:16


















0















I have an update panel with ChildrenAsTriggers set to true so there is no actual script manager defined on the ascx file or in the code behind file.



Inside there is a list view, whos OnItemDataBound calls this function:



// ------------------------------------------------
// Register Update Panel Async Postback Triggers for View Order Buttons
// ------------------------------------------------
protected void orderListView_ItemDataBound(object sender, ListViewItemEventArgs e)
{
var scriptManager = ScriptManager.GetCurrent(Page);
LinkButton lbOne = e.Item.FindControl("viewOrder") as LinkButton;
scriptManager.RegisterAsyncPostBackControl(lbOne); // ToolkitScriptManager
}


This is supposed to take the LinkButton inside the List View, and register the buttons so a hard refresh does not occur when it is clicked.



For some reason, it only works on the first click of the link button in the list view. If I click it again, it does a hard refresh and buttons no longer seemed to be bound.



Any suggestions on why this may be?










share|improve this question

























  • If I put an UpdatePanel on the page without a SciptManager I get the error "The control with ID 'UpdatePanel1' requires a ScriptManager on the page". How did you get around this?

    – VDWWD
    Nov 14 '18 at 20:08











  • I believe its because ChildrenAsTriggers="true" is flagged on the update panel after runat="server"

    – Isaac Byrne
    Nov 14 '18 at 20:10











  • Noe that does not matter. Are you perhaps using a Master page? And could have that page the ScriptManager?

    – VDWWD
    Nov 14 '18 at 20:12











  • Sorry, I misspoke, this is likely the case as it's an ascx file not an aspx file.

    – Isaac Byrne
    Nov 14 '18 at 20:13











  • Ah, then the SciptManager is on the page itself. But that does not explain your issue. Everything in an UpdatePanel automatically does a Async PostBack. So there should be no need to register that Control with ScriptManager.RegisterAsyncPostBackControl(lbOne). I cannot reproduce the issue...

    – VDWWD
    Nov 14 '18 at 20:16
















0












0








0








I have an update panel with ChildrenAsTriggers set to true so there is no actual script manager defined on the ascx file or in the code behind file.



Inside there is a list view, whos OnItemDataBound calls this function:



// ------------------------------------------------
// Register Update Panel Async Postback Triggers for View Order Buttons
// ------------------------------------------------
protected void orderListView_ItemDataBound(object sender, ListViewItemEventArgs e)
{
var scriptManager = ScriptManager.GetCurrent(Page);
LinkButton lbOne = e.Item.FindControl("viewOrder") as LinkButton;
scriptManager.RegisterAsyncPostBackControl(lbOne); // ToolkitScriptManager
}


This is supposed to take the LinkButton inside the List View, and register the buttons so a hard refresh does not occur when it is clicked.



For some reason, it only works on the first click of the link button in the list view. If I click it again, it does a hard refresh and buttons no longer seemed to be bound.



Any suggestions on why this may be?










share|improve this question
















I have an update panel with ChildrenAsTriggers set to true so there is no actual script manager defined on the ascx file or in the code behind file.



Inside there is a list view, whos OnItemDataBound calls this function:



// ------------------------------------------------
// Register Update Panel Async Postback Triggers for View Order Buttons
// ------------------------------------------------
protected void orderListView_ItemDataBound(object sender, ListViewItemEventArgs e)
{
var scriptManager = ScriptManager.GetCurrent(Page);
LinkButton lbOne = e.Item.FindControl("viewOrder") as LinkButton;
scriptManager.RegisterAsyncPostBackControl(lbOne); // ToolkitScriptManager
}


This is supposed to take the LinkButton inside the List View, and register the buttons so a hard refresh does not occur when it is clicked.



For some reason, it only works on the first click of the link button in the list view. If I click it again, it does a hard refresh and buttons no longer seemed to be bound.



Any suggestions on why this may be?







c# asp.net






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 20:14







Isaac Byrne

















asked Nov 14 '18 at 19:54









Isaac ByrneIsaac Byrne

299214




299214













  • If I put an UpdatePanel on the page without a SciptManager I get the error "The control with ID 'UpdatePanel1' requires a ScriptManager on the page". How did you get around this?

    – VDWWD
    Nov 14 '18 at 20:08











  • I believe its because ChildrenAsTriggers="true" is flagged on the update panel after runat="server"

    – Isaac Byrne
    Nov 14 '18 at 20:10











  • Noe that does not matter. Are you perhaps using a Master page? And could have that page the ScriptManager?

    – VDWWD
    Nov 14 '18 at 20:12











  • Sorry, I misspoke, this is likely the case as it's an ascx file not an aspx file.

    – Isaac Byrne
    Nov 14 '18 at 20:13











  • Ah, then the SciptManager is on the page itself. But that does not explain your issue. Everything in an UpdatePanel automatically does a Async PostBack. So there should be no need to register that Control with ScriptManager.RegisterAsyncPostBackControl(lbOne). I cannot reproduce the issue...

    – VDWWD
    Nov 14 '18 at 20:16





















  • If I put an UpdatePanel on the page without a SciptManager I get the error "The control with ID 'UpdatePanel1' requires a ScriptManager on the page". How did you get around this?

    – VDWWD
    Nov 14 '18 at 20:08











  • I believe its because ChildrenAsTriggers="true" is flagged on the update panel after runat="server"

    – Isaac Byrne
    Nov 14 '18 at 20:10











  • Noe that does not matter. Are you perhaps using a Master page? And could have that page the ScriptManager?

    – VDWWD
    Nov 14 '18 at 20:12











  • Sorry, I misspoke, this is likely the case as it's an ascx file not an aspx file.

    – Isaac Byrne
    Nov 14 '18 at 20:13











  • Ah, then the SciptManager is on the page itself. But that does not explain your issue. Everything in an UpdatePanel automatically does a Async PostBack. So there should be no need to register that Control with ScriptManager.RegisterAsyncPostBackControl(lbOne). I cannot reproduce the issue...

    – VDWWD
    Nov 14 '18 at 20:16



















If I put an UpdatePanel on the page without a SciptManager I get the error "The control with ID 'UpdatePanel1' requires a ScriptManager on the page". How did you get around this?

– VDWWD
Nov 14 '18 at 20:08





If I put an UpdatePanel on the page without a SciptManager I get the error "The control with ID 'UpdatePanel1' requires a ScriptManager on the page". How did you get around this?

– VDWWD
Nov 14 '18 at 20:08













I believe its because ChildrenAsTriggers="true" is flagged on the update panel after runat="server"

– Isaac Byrne
Nov 14 '18 at 20:10





I believe its because ChildrenAsTriggers="true" is flagged on the update panel after runat="server"

– Isaac Byrne
Nov 14 '18 at 20:10













Noe that does not matter. Are you perhaps using a Master page? And could have that page the ScriptManager?

– VDWWD
Nov 14 '18 at 20:12





Noe that does not matter. Are you perhaps using a Master page? And could have that page the ScriptManager?

– VDWWD
Nov 14 '18 at 20:12













Sorry, I misspoke, this is likely the case as it's an ascx file not an aspx file.

– Isaac Byrne
Nov 14 '18 at 20:13





Sorry, I misspoke, this is likely the case as it's an ascx file not an aspx file.

– Isaac Byrne
Nov 14 '18 at 20:13













Ah, then the SciptManager is on the page itself. But that does not explain your issue. Everything in an UpdatePanel automatically does a Async PostBack. So there should be no need to register that Control with ScriptManager.RegisterAsyncPostBackControl(lbOne). I cannot reproduce the issue...

– VDWWD
Nov 14 '18 at 20:16







Ah, then the SciptManager is on the page itself. But that does not explain your issue. Everything in an UpdatePanel automatically does a Async PostBack. So there should be no need to register that Control with ScriptManager.RegisterAsyncPostBackControl(lbOne). I cannot reproduce the issue...

– VDWWD
Nov 14 '18 at 20:16














0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53307848%2fonitemdatabound-registers-link-buttons-in-list-view-to-update-panels-script-mana%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53307848%2fonitemdatabound-registers-link-buttons-in-list-view-to-update-panels-script-mana%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Florida Star v. B. J. F.

Error while running script in elastic search , gateway timeout

Adding quotations to stringified JSON object values