Feb 11, 2020 08:25 AM|Yongqing Yu|LINK
Hi Srishti ,
We have a jquery popup with close and Add button, the close button is working tine with data-dismiss attribute, now i want to call the same attributes in code behind on btnAdd event, here is the code
To add attribute to the control in the code behind, you can refer to the following code:
protected void btnAdd_Click(object sender, EventArgs e)
btnAdd.Attributes["data-dismiss"] = "modal";
As far as I know, the use of data-dismiss in bootstrap is to close the modal popup box without refreshing the page.
When you trigger the onclick code behind event of the add button and add the data-dismiss property to the button, the page will refresh immediately , the attribute will also disappear, so if you add the attribute
in the onclick code behind event will not prevent you from clicking the add button to refresh the page.
If you just want to click the add button and the page will not refresh, then I suggest you use
ajax with webmethod to achieve your needs.
If I understand correctly, I suggest you provide us with your detailed requirements and code, if not, then please tell us your detailed requirements.