---
title: "Set multiple title on common modal popup window on button click in mvc"  
description: "Set multiple title on common modal popup window on button click in mvc"  
author: "Anonymous User"  
published: 2017-12-13  
updated: 2017-12-13  
canonical: https://www.mindstick.com/forum/34394/set-multiple-title-on-common-modal-popup-window-on-button-click-in-mvc  
category: "c#"  
tags: ["c#", "asp.net mvc", "mvc", "mvc4", "razor"]  
reading_time: 2 minutes  

---

# Set multiple title on common modal popup window on button click in mvc

Hi [Expert](https://www.mindstick.com/articles/13120/an-expert-financial-advice-will-improve-your-finances),

Here is my code. i am open [common](https://www.mindstick.com/articles/23170/10-most-common-accounting-mistakes-of-small-business) [modal popup](https://www.mindstick.com/articles/13038/crud-operation-searching-paging-in-mvc-with-modal-popup) on different [button click](https://www.mindstick.com/forum/790/form-gets-submiited-twice-on-button-click). I want to set [title](https://www.mindstick.com/articles/12860/how-to-get-financing-for-salvage-title-cars) of modal popup on button click.

```
<a class="btn btn-primary btn-sm pull-right openDialog" style="margin-top:-5px;margin-bottom:-3px" href="@Url.Action("Add")"><i class="fa fa-plus"></i></a>
```

```
$(document).on("click", ".openDialog", function (e) {

        e.preventDefault();

        var me = this;

        var option = { "backdrop": "static", keyboard: true };

        $.ajax({

            type: "GET",

            url: $(this).attr("href"),

            success: function (data) {

                $('#modelContent').html(data);

                $('#modelDialog').modal(option);

                $('#modelDialog').modal('show');

            }

        });

    });
```

Please give me some idea to achieve this task.

## Replies

### Reply by Hemant Patel

Hello Aarav,

I analyzed your code. Please follow below modified line of code in your project.

```
<a class="btn btn-primary btn-sm pull-right openDialog" title="Add Candidate" style="margin-top:-5px;margin-bottom:-3px" href="@Url.Action("Add")"><i class="fa fa-plus"></i></a>
```

```
$(document).on("click", ".openDialog", function (e) {
        e.preventDefault();
        var me = this;
        var option = { "backdrop": "static", keyboard: true };
        $.ajax({
            type: "GET",
            url: $(this).attr("href"),
            success: function (data) {
                $('#modelContent').html(data);
                $('#modelDialog').find('.modal-title').html($(me).attr("title"));
                $('#modelDialog').modal(option);
                $('#modelDialog').modal('show');
            }
        });
    });
```

Hope its informative for you !! \


---

Original Source: https://www.mindstick.com/forum/34394/set-multiple-title-on-common-modal-popup-window-on-button-click-in-mvc

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
