Discover a new way to showcase user information by utilizing the popover feature of Bootstrap, all without the need for a

I am currently working on a project in razor page asp.net and I have encountered an issue. I am unable to display user details using a mouse hover or popover without relying on the bootstrap modal.

Here is the code I am using:

<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#userDetailsModal">
View User Details
    </button>

I am using the bootstrap modal to display user details:

<div class="modal fade" id="userDetailsModal" tabindex="-1" role="dialog" aria-labelledby="userDetailsModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="userDetailsModalLabel">User Details</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <p><strong>User Name:</strong> @TempData["UserName"]</p>
                    <p><strong>User Role:</strong> @TempData["UserRole"]</p>
                    <p><strong>Environment:</strong> @TempData["Environment"]</p>
                    <p><strong>User ID:</strong> @TempData["UserId"]</p>
                    <p><strong>StatusCode:</strong> @TempData["StatusCode"]</p>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                </div>
            </div>
        </div>
    </div>

I am passing the user details using temp data from the model to the view and the data is being passed successfully.

Here is an image depicting what I aim to achieve:

https://i.sstatic.net/d4IDS.jpg

Update:

Could you please provide an example of how I can apply a popover to the attached sample code?

Answer №1

It looks like you are currently using Boostrap 4 modal to display the data. However, with the transition to Asp.Net Core, it now utilizes Boostrap 5. There are some code differences between Boostrap 4 and Boostrap 5. You can update your code to:

<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#userDetailsModal">
    View User Details
</button>

<div class="modal fade" id="userDetailsModal" tabindex="-1" role="dialog" aria-labelledby="userDetailsModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="userDetailsModalLabel">User Details</h5>
                <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
                <p><strong>User Name:</strong> @TempData["UserName"]</p>
                <p><strong>User Role:</strong> @TempData["UserRole"]</p>
                <p><strong>Environment:</strong> @TempData["Environment"]</p>
                <p><strong>User ID:</strong> @TempData["UserId"]</p>
                <p><strong>StatusCode:</strong> @TempData["StatusCode"]</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is it possible to send arguments to the functions executed by "jQuery then"?

Check out the complete code here: http://jsfiddle.net/BurFz/ http://jsbin.com/dagequha/1/edit?js,console /** * executed function chain */ func1('arg1').then(func2).then(func3).then(function () { console.log('execution comp ...

Is there a more effective method for positioning items in a navigation bar other than using padding-left?

Hey there, I've been working on this navigation bar for quite some time now and finally found a way to center the menu items. However, I want to make sure I'm doing it the right way. Does anyone have suggestions on how to center all the "li" elem ...

An unexpected pop-up box and web address

I have a link that opens information about me in a modal window: <a id="about-me" class="popup">Info About Me</a> When the link is clicked, it uses the following jQuery code to load the info about me content: $(document).ready(function(){ ...

Eliminate the standard cell padding in nested HTML tables

In my setup, there is a parent table where each td tag in the tr tag contains a child table. Specifically, as shown in the example with Data WS-C3.... in the picture. [![<table class="table table--bordered table--nostripes table-top"> <thead& ...

Issue with clicking on text content within an iframe using jQuery

Using a menu type, I am loading the respective content in an iframe with the same domain URL. When clicking the div (using class name) inside the iframe content, I need to reload the URL. I attempted the following code. HTML Code: <ul> <li href ...

Displaying iFrame Border in React Native WebView

When attempting to dynamically add YouTube videos to my React Native app, I decided to utilize a combination of WebView and iFrame due to the incompatibility of the current react-native-youtube component with RN 16+. Although this solution works, the ifram ...

What is preventing Django from upgrading to a newer version of jQuery?

One issue I have encountered is that many Django admin plugins come with their own version of jQuery, which can cause conflicts when trying to use them together. For example, I've run into this problem with django-markitup and django-sortable. Is th ...

Unable to load JQuery from a div element

My goal is to create a standard .html file containing the navigation, footer, and other elements that will be used across multiple pages for a small site I'm building. I want to keep it simple and avoid using php or other programming languages. I&apo ...

Grid sidebar using tailwindcss

I just started using Tailwind CSS, but I'm having trouble understanding how the grid system works! I want my layout to look like this: https://i.sstatic.net/hlHmy.png Here is what I tried, but it's not working as expected: <div class=" ...

Execute and showcase code without redundancies

I have been exploring a way to store JavaScript code within an object and execute specific parts of it upon the user clicking a button. Here's what I've come up with so far: var exampleCode = { test: "$('body').css('background ...

"Introducing a fresh new appearance for our User Form and Legend

Here is the UI layout I have set up for a basic form. http://jsfiddle.net/h5Zbj/2/ The input type="checkbox" is a checkboxlist in my asp.net form. Does anyone have suggestions on how to style it? I came across a solution on Google, but it has mo ...

Setting the height of a webpage element to match the height of the window through CSS

How can I make the .Bck div stretch to the full height of the browser window? I attempted using jQuery, but the height doesn't adjust correctly when I resize the window. What is wrong with my JavaScript and can this be achieved with CSS alone? <!- ...

"Disappearing act: box-shadow magically vanishes

Currently facing a perplexing issue: In my code, there is a div called .pagebody with a box shadow assigned as follows: -webkit-box-shadow: 0px 1px 10px -2px rgba(71,71,71,0.42); box-shadow: 0px 1px 10px -2px rgba(71,71,71,0.42); -moz-box-shadow: 0px 1px ...

Prevent jquery-ui datepicker from opening when the confirmation box is cancelled

Here are the snippets of code I'm currently working with: HTML, Date : <input id="datepicker"> Fare : <input id="fare"> JS, <script> $(function(){ $("#datepicker" ).datepicker({ changeMonth: true, ...

Guy discussing the ins and outs of JavaScript variables

I am facing an issue with retrieving the value in the jQuery script. The value should be taken from route_path_images, but it's not showing up. var route_path_images="http://www.domain.com" jQuery("#header_background_night_star").fadeIn(2000).css("b ...

Trigger a click event to alter the child div elements

I have a <div> that expands when clicked and shrinks back when clicked again. Inside this div are images that should only appear once the div expands. My issue is ensuring that all images except the first one are hidden until the div expands. https: ...

Adding complex JSON format to an HTML table involves formatting the data correctly and then using

Utilizing AJAX, I fetched a JSON response and am now looking to map the JSON data into an HTML table structured like this: { "records": [{ "type_id": 000001, "type_desc": "AAAAAA", "type_createby": "Adam" }, { "type ...

Utilizing jQuery with live content to determine dimensions as required

Within my web application, I have a page that dynamically retrieves a view with both HTML and JavaScript. The JavaScript is responsible for rendering a chart into the retrieved view. The problem arises because the chart library I am utilizing (flot) necess ...

Implementing Custom Headers in jQuery AJAX Requests

Recently, I encountered an issue while making a request to the iContact API that required the use of a custom header for authentication (http://developer.icontact.com/documentation/authenticate-requests). Here is the code snippet I used: $.ajax({ ...

"Put Phonegap on hold for a bit and disable landscape mode

I am currently using Phonegap to develop an Android game. My project includes a lobby feature where players can search for opponents and engage in chat with other players. Once a player has found their opponent, they can commence playing the game together ...