问题标签 [contentplaceholder]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
512 浏览

asp.net - 更改 ContentPlaceHolder 的 ID

我有一个母版页。在此母版页中,我有一个内容占位符,id="ContentPlaceHolder1" 我将其更改为id="main-content"然后更改使用此母版页创建的任何内容页的 ContentPlaceHolderID,但出现错误:

'main-content' 不是有效的标识符。

我应该怎么办?

0 投票
2 回答
1879 浏览

asp.net - 将会话值分配给 Asp.net 中的标签

我有两个母版页。在第一个母版页中,我有一个 login.aspx 页面,它打开一个会话 [“用户名”]。在第二个母版页中,我有一个链接到它的子母版页。在子母版页中,我在父母版页的 contentplaceholder 中有一个 contentplaceholder。除了子母版页的 contentplaceholder 之外,我可以将会话值分配给任何地方的标签。没有错误,但运行时的标签显示为空白。我希望将 session["username"] 值分配给标签。

任何帮助,将不胜感激。

0 投票
1 回答
195 浏览

php - 占位符更改数据

我有一个表格可以获取用户的电话并将其存储在数据库中。然后我从数据库中获取数据并将其放在这样的占位符上。

一切安好。我想让占位符的数据显示为可编辑的文本,以便用户可以轻松更改他的电话号码。有什么建议么?

0 投票
2 回答
755 浏览

asp.net - 会话和 ContentPlaceHolders

是否可以在 MasterPage 中设置一个 Container(ContentPlaceHolder),并在需要时隐藏它?

例如,我想放置 2 个文本框和一个按钮供用户登录,但如果会话仍在运行(即用户已经登录),我希望将这 2 个文本框和按钮更改为欢迎消息(例如: “欢迎,用户名”)。

在此处输入图像描述

MasterPage(注意:并非所有内容都经过编码)

0 投票
2 回答
3201 浏览

javascript - Hangman Javascript - 当一个字母被正确猜到时,我的代码似乎没有更新单词占位符

因此,我的程序将随机单词打印到控制台,以便我可以检查该单词是用于测试和实现的,因此当我测试代码并猜测正确的正确字母时,单击猜测按钮后单词占位符不会更新只是循环通过刽子手的阶段。这是我的程序代码;

这是我的占位符代码,问题必须存在,程序也运行良好,我没有收到任何错误。

这是链接到代码的 HTML;

如果有人能告诉我问题出在哪里,那就太好了,在此先感谢。

0 投票
1 回答
378 浏览

jquery - Webforms - The right way to navigate using master & content pages without a page refresh

taking in considiration the issue of SEO while designing my web site i was trying to create a nice way to navigate between pages

using content place holders within divs as follows

the idea was that on menuitem clicked, the 4 squers within Left column will turn into 1 main content div displaying the menu-itemas other content pages.

a theory : the rest of .aspx contents , that the right menu is redirecting to, could have been within the default.aspx page (hidden until clicking on a menu item) though i was thinking of 2 problems:

for starter if i will use all contents of menu-items (.aspx content pages) within default.aspx ... that way, the page will be too heavy to load.

and second is: with SEO in mind,(which also includes the issue of that page load timing) but also the idea that my website will only have one .aspx page for its content and i think that it is not good for SEO having only one .aspx page... so all in all, i guess that's not a good idea to use hidden content on one url/aspx page

take a look at my current home page you will get the idea LINK

The question is: if i want to have:

1) no page refresh

2) animation when switching contents, while navigating to other content pages

3) implementing it via using asp.net master vs content pages with <asp:contentPlaceHolder>

what would be the approach (taking into account that i need that content to help with SEO...)

0 投票
2 回答
4269 浏览

javascript - 使用 javascript 从母版页访问内容页面控件

我想通过使用 Javascript 访问母版页中的内容页面 Ajax 组合框控件。

我一直在尝试使用内容页面的 contentpageholder,但我遇到的问题之一是大约有 10 个内容页面,因此当打开第 1 页等其他页面时,代码将对象引用异常显示为 contentplaceholder不匹配。

如何获得打开的内容页面?此外,我无法让代码工作以获取母版页中的 maincontentplaceholder id。

到目前为止我所做的:

但这不起作用。有同样的帮助吗?

0 投票
1 回答
1102 浏览

javascript - Javascript 在用户控件中找不到 div 的 ID

我将 coda 滑块放在用户控件(ascx 文件)中,它在测试页面上运行良好。

但是,当我将相同的用户控件放在基于母版页的测试页中的内容占位符中时,它会停止正常工作。现在看来,javascript 函数无法正确识别 DIV 的 ID,因为它位于内容占位符内。我已经阅读了一些其他链接,但它们的情况似乎略有不同,我尝试使用 document.getElementById,但不确定我是否走在正确的轨道上,或者只是弄乱了语法。我还尝试将 ct100_cpMC_ 放在 id 前面。

在我的用户控件内部是一个 ID 为“slider-id”的 DIV,javascript 函数需要找到它。

正如我之前提到的,我不确定是否需要使用 document.getElementById 以及如何使用,或者是否有一种更简单的方法,即在引号 $('#slider-id') 中将一些内容添加到 ID 以便 javascript 函数知道 ID它正在寻找内容占位符。

0 投票
1 回答
1149 浏览

javascript - asp.net master page and javascript

I got one question, and I try to search in the forums, but I can't seem to put this to good use. I have a simple website using a master page, everything works fine, I even put a navigation bar and works nicely :)

But I'm trying to change my maincontentplaceholder using javascript, I try with location.href and a solution I quite get for now which is __PostBackURL but I get a full refresh of the page and I lost the "master page" (header).

My Master page:

And the several container.aspx they are the same for now:

In one of this containers I have a .js file with some stuff:

I know this is kind of messy :( Is this possible?

Hope someone can tell me there is a way :)

0 投票
1 回答
1573 浏览

c# - 内容占位符背景图片

可以为内容占位符设置背景图像吗?目前,我可以为整个页面显示背景图片,但内容占位符挡住了大部分图片,所以我想为内容占位符设置背景图片(大部分内容都在持有人中) .

这是我在背景中显示图像的代码,但我不知道如何将其放置在 ASP.NET 的内容占位符中:

在我的 html 方面,我只需添加一个 body id = "PageBody" 就可以了。但我如何在内容占位符中做到这一点?我是编程以及 CSS 或 Html 的新手。