1

So basically if I go with:

<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#@Model.ID">
<div class="modal fade" id="@Model.ID" tabindex="-1" role="dialog" aria-labelledby="CenterTitle"" aria-hidden="true">

it does not work! (ID is public Guid ID { get; set; }) The button does not open the modal window.

If I manually change to something like

 <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#id11">
<div class="modal fade" id="id11" tabindex="-1" role="dialog" aria-labelledby="CenterTitle"" aria-hidden="true">

it works? Any idea?

marto
  • 420
  • 1
  • 4
  • 15
  • 1
    What is the actual value of `@Model.ID`. What is showing if you place it somewhere else? – VDWWD May 23 '19 at 11:57
  • it is different but something like Guid.NewGuid() or "0a757770-02dd-4dbd-972e-9a307174224b" – marto May 23 '19 at 12:57
  • https://stackoverflow.com/questions/6492433/id-generation-for-html-elements-in-asp-net-mvc does that work? Guid.NewGuid().ToString("N"); – UnpassableWizard May 23 '19 at 19:51

1 Answers1

2

The problem was that the Guid value sometimes starts with a number and that's a problem for CSS.

marto
  • 420
  • 1
  • 4
  • 15