Hi
I have below code and i want to pass multiple parameters to User Control . In User Control i have modal defined
string deleteAttributes = Status == "Blocked" ? "style='pointer-events: none; opacity: 0.5;' onclick='return false;'" : "data-toggle='modal' data-target='#modal_Delete' ";
htmlTable.Append($"");
Thanks
Naimish MakwanaPosted Aug 28, 2024, 11:57 AM
To pass multiple parameters to the User Control dynamically, you can use HTML data attributes in combination with JavaScript to transfer the data to the modal. Here's how you can modify your code:
1. Modify the Link Button with Additional Data Attributes:
Update your link button to include additional data attributes that will hold the
IdandTableNameor any other parameters you need to pass.2. Capture the Data in JavaScript:
You can use JavaScript to capture these data attributes when the modal is triggered and set them in the modal's controls.
3. Modify the Modal Markup:
Make sure your modal has controls (e.g., hidden fields or labels) where these values will be assigned.
4. Accessing Parameters in the Code-Behind:
You can access these parameters in the code-behind when the delete button is clicked.
This approach allows you to dynamically pass multiple parameters to your User Control modal and handle them as needed in your ASP.NET application.