Hi
In below code Dynamic Link Button r created in Gridview RowDataBound. I want when user clicks on burron Data should get dispayed in Modal Popup Repeater
C#
protected void gr_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType != DataControlRowType.DataRow)
return;
e.Row.Cells[0].HorizontalAlign = HorizontalAlign.Center;
for (int i = 6; i ");
sb.Append(@"$('#modal_form_horizontal').modal('show');");
sb.Append(@"");
ClientScript.RegisterStartupScript(this.GetType(), "JSScript", sb.ToString());
}Thanks

Rajkiran SwainRank #165 · 14.4K reputationPosted May 17, 2023, 1:57 AM EDT
To display data in a modal popup repeater when a user clicks on a dynamic link button in a GridView, you can follow these steps:
1. Add a modal popup control to your page. Make sure it has an ID assigned to it.
```html
```
2. Modify your link button creation code in the `gr_RowDataBound` event handler to include a data-toggle attribute and a data-target attribute to associate the link button with the modal popup.
```csharp
button.OnClientClick = "GetModuleData(this);";
button.Attributes["data-toggle"] = "modal";
button.Attributes["data-target"] = "#modal_form_horizontal";
```
3. In your JavaScript code, define the `GetModuleData` function to handle the click event of the link button. This function should extract the necessary data from the link button and populate the modal popup with the data.
```javascript
function GetModuleData(linkButton) {
var commandArgument = linkButton.getAttribute("data-CommandArgument");
// Extract the required data from the commandArgument string
// Populate the modal popup with the data
// You can use AJAX to fetch the data from the server and bind it to the repeater inside the modal popup
// Finally, show the modal popup
$('#modal_form_horizontal').modal('show');
}
```
4. In your code-behind, modify the `ShowPopUpData` method to only show the modal popup without any other logic.
```csharp
private void ShowPopUpData()
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowPopUp", "$('#modal_form_horizontal').modal('show');", true);
}
```
Ensure that you have registered the `ScriptManager` control in your page.
With these modifications, when the user clicks on the dynamic link button in the GridView, the `GetModuleData` function will be called. It will extract the necessary data, populate the modal popup with the data (using AJAX if required), and show the modal popup using the `$('#modal_form_horizontal').modal('show');` code.
Ramco RamcoRank #462 · 5.4K reputationPosted May 17, 2023, 2:06 AM EDT
Hi RajKiran
Can u pls explain below. Do i need to use WebMethod
// Populate the modal popup with the data
// You can use AJAX to fetch the data from the server and bind it to the repeater inside the modal popup
Thanks