I have added linkbutton inside html table dynamically and add into bootstrap modal's body. (linkbutton has coded linkbutton.click += new eventhandler(Eventclick1);)
but, when I click on select, it won't go to my function Eventclick1
. It just refreshes the whole page. (it is already inside updatepanel). Anyways I can make the select
button to postback? (I don't want to add client side click function like onclientclick = $('#otherbutton').click();
)
UPDATE
lnk_button.ID = this.ID + "AuditSelectedRow_" + Convert.ToString(l_loop);
lnk_button.Click += new EventHandler(OnAuditRowSelected);
lnk_button.Text = "Select";
WebControl wc_tdSelect = new WebControl(HtmlTextWriterTag.Td);
wc_tdSelect.Controls.Add(lnk_button);
First make sure that your custom webcontrol inside Updatepanel still exist at the end of page life cycle. I assume you are calling a function where you are adding linkbutton to the webcontrol. something like this:
// Custom function Creating link buttons
private void CreateControls() {
// Create your link buttons here.
}
Now try calling the same function again inside page pre-init method which ensures that the control still exist at the time of button click event. something like this:
//Page Pre Init
protected void Page_PreInit(object sender, EventArgs e)
{
CreateControls();
}
Make sure you have your web control added to updatepanel inside the same function as listed above. Here is a sample code attaching webcontrol to the updatepanel.
yourUpdatePanel.ContentTemplateContainer.Controls.Add(wc_tdSelect);
I am sure you will have your desired result this time :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With