嗨我已经在堆栈溢出搜索了很多,以找到我的问题的合适答案,但找不到它.我希望你们能解决我的问题.
我有一个Web应用程序,它有两个更新面板.
第一个更新面板仅包含一个定时器,其间隔仅为一秒,它充当倒计时器.
第二个更新面板是条件面板,仅在倒计时结束时更新.
我面临的问题是,当我发布我的Web应用程序时,计时器似乎无法正常工作在页面上的一些用户来到顶部(我假设它得到刷新).在本地主机上它完美无缺地运行.下面给出了aspx文件和aspx.cs文件的代码
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick">
</asp:Timer>
<div class="form-area">
<div class="clock">
<p><img id="c-time" src="images/clock.png"/>Current Time
<span class="spanclass">
<asp:Label ID="CurrentTimeLabel" runat="server" Text="Label">
</asp:Label>
</span>
</p>
</div>
<p id="text">
<asp:Label ID="Processing" runat="server" Text="Label"></asp:Label>
<br />
<asp:Label ID="FilterLabel" runat="server" Text="Label"></asp:Label>
<br />Time Left for list to Refresh
<span class="spanclass">
<asp:Label ID="TimeLeftLabel" runat="server" Text=""></asp:Label>
</span>
</p>
</div>
<div class="clear"></div>
</ContentTemplate>
</asp:UpdatePanel>
Run Code Online (Sandbox Code Playgroud)
和aspx.cs
protected void Timer1_Tick(object sender, EventArgs e)
{
CurrentTimeLabel.Text = DateTime.Now.ToShortTimeString();
if (SecondsLeft > 0) …Run Code Online (Sandbox Code Playgroud) 我见过类似的问题,但没有一个答案帮助我解决了这个问题.我有一个带有ReadOnly字段的GridView,如下所示.
网格视图:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AutoGenerateColumns="False" DataKeyNames="projectID"
DataSourceID="SqlDataSource1"
EmptyDataText="There are no data records to display."
PageSize="5" OnRowUpdating="GridView1_RowUpdating">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True"/>
<asp:BoundField DataField="prID" HeaderText="prID" SortExpression="prID"/>
<asp:BoundField DataField="projectName" HeaderText="projectName"
SortExpression="projectName" />
<asp:BoundField DataField="projectType" HeaderText="projectType"
SortExpression="projectType" />
</Columns>
<EditRowStyle CssClass="GridViewEditRow"/>
</asp:GridView>
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,prIDBoundField具有Readonly=True属性.prID当用户更新行中的其他字段时,我正试图获取代码隐藏的值.
后台代码:
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
GridViewRow row = GridView1.Rows[e.RowIndex];
String d1 = ((TextBox)(row.Cells[2].Controls[0])).Text;
String d2 = ((TextBox)(row.Cells[3].Controls[0])).Text;
// this only works while the field is not readonly
string prIDUpdate = …Run Code Online (Sandbox Code Playgroud) 我使用Bootstrap 3带Jquery.我有一个按钮,在span标签中包含一个图标.(使用bootstrap的glypicon)
<button id="swapArchived" class="btn btn-default btn-sm showArchived">
<span class="glyphicon glyphicon-road"></span> Show Archived
</button>
Run Code Online (Sandbox Code Playgroud)
我想在点击时更改图标和文字.有没有更好的方法,除了,
$('#swapArchived').on('click', function () {
var $el = $(this);
if($el.hasClass('showArchived'))
{
$el.html('<span class="glyphicon glyphicon-fire"></span> Show Incomplete');
}
else
{
$el.html('<span class="glyphicon glyphicon-road"></span> Show Archived');
}
$el.toggleClass('showArchived');
});
Run Code Online (Sandbox Code Playgroud)
我很好奇我是否可以同时切换按钮文本和跨类.试图避免在每次点击时写入跨度.
谢谢-
我正在为我的网站制作一个简单的主页,但我希望能够均匀地分散.我可以将左边的左边和右边的边缘对齐,但我似乎无法将中间位置保持在页面的中心位置.我尝试了很多东西,但它们都不起作用,看看我的网站看看我想做什么,井在图像滑块下面.这是我已经完成的代码,但CSS是默认的bootstrap min css,对颜色进行了一些调整.
<div class="container">
<div class="row">
<div class="col-lg-4 well" style="margin-left: 10px !important; width: 330px;
margin-right: 10px; padding: 4px !important; min-height: 330px; ">
<center>
<img style="height: 135px;" src="img/ts.png" />
<h3>TeamSpeak 3</h3>
<br />
<p>Chat with us on our TeamSpeak at: <br />
<b><a href="ts3server://ts.clustermc.net">ts.clustermc.net</a></b>
<br /> So, come have a wonderful conversation with us!</p>
</center>
</div>
<div class="col-lg-4 well" style="margin-left: 10px !important; width: 330px;
margin-right: 10px; padding: 4px !important; min-height: 330px; ">
<center>
<img style="height: 135px;" src="img/wool.png" /> …Run Code Online (Sandbox Code Playgroud) 我有gridview5列,最后一列只对某些成员可见.我希望当最后一列gvMessageList.Columns[4]不可见时,它的宽度百分比应该给第一列gvMessageList.Columns[0].
请让我知道,怎么可能.
我GridView的如下:
<asp:GridView ID="gvMessageList" runat="server" Width="100%" AutoGenerateColumns="false" AllowPaging="true" AllowSorting="true"
DataKeyNames="MESSAGE_ID" CellPadding="4" PageSize="51" EmptyDataText="No Records Found." OnSorting="gvMessageList_Sorting"
OnPageIndexChanging="gvMessageList_PageIndexChanging" OnRowDataBound="gvMessageList_RowDataBound" GridLines="None"
CssClass="table table-bordered table-condensed table-hover table-striped">
<Columns>
<asp:TemplateField HeaderText="Subject" HeaderStyle-Width="30%" SortExpression="MESSAGE_SUBJECT" HeaderStyle-BackColor="#D9EDF7"
HeaderStyle-ForeColor="#0088CC">
<ItemTemplate>
<asp:HyperLink ID="hlnkMessageSubject" runat="server" Text='<%# ((System.Data.DataRowView)Container.DataItem)["MESSAGE_SUBJECT"] %>'
NavigateUrl='<%# ((System.Data.DataRowView)Container.DataItem)["MESSAGE_URL"] %>'>
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="From" HeaderStyle-Width="14%" SortExpression="MESSAGE_FROM" HeaderStyle-BackColor="#D9EDF7"
HeaderStyle-ForeColor="#0088CC">
<ItemTemplate>
<asp:HyperLink ID="hlinkUser" runat="server" Text='<%#((System.Data.DataRowView)Container.DataItem)["MESSAGE_FROM"] %>'
NavigateUrl='<%#((System.Data.DataRowView)Container.DataItem)["FROM_URL"] %>'>
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="CREATION_DATE" HeaderText="On" HeaderStyle-Width="15%" HeaderStyle-BackColor="#D9EDF7" HeaderStyle-ForeColor="#0088CC"
SortExpression="CREATION_DATE" />
<asp:TemplateField HeaderText="To" …Run Code Online (Sandbox Code Playgroud)