我有一个带有'打印机友好'按钮的页面,它使用jQuery的.css()方法从特定元素中删除一些背景和边框,并更改字体大小.我可以设置另一个.css()方法来将所有内容更改回原来的样式,但有没有简单的方法可以将页面上的所有内容恢复为原始CSS(除了刷新页面)?
有没有办法根据使用的Unicode字符自动检测TextBox中的FlowDirection?
如果Excel中有阿拉伯文本,它将自动对齐到单元格的右侧.我想在我的WPF应用程序中使用相同的逻辑.有没有人经历过这个,可以告诉我该怎么做?
我正在尝试在页面上使用几个asp.net复选框,相应地禁用它们.
<asp:CheckBox ID='chkMenuItem' runat='server' CssClass='HiddenText' Text='Test' onclick='<%#String.Format("checkChild({0});", Eval("id")) %>' />
Run Code Online (Sandbox Code Playgroud)
在JavaScript上,我使用以下代码
function checkChild(id) {
for (i = 0; i < $("input[id*=hdnParentMenuItemID]").length; i++) {
if ($('input[id*=hdnParentMenuItemID]')[i].value.split(':')[0] == id) {
var childID = $('input[id*=hdnParentMenuItemID]')[i].value.split(':')[1];
if ($("#" + childID).attr("disabled"))
//$("#" + childID).attr('disabled', '');
$("#" + childID).removeAttr("disabled");
else
$("#" + childID).attr('disabled', true);
}
}
}
Run Code Online (Sandbox Code Playgroud)
现在,加载页面后禁用复选框,removeAttr部分不起作用.我试图通过调试器,逻辑工作完全正常.如果在页面加载时未禁用复选框,则代码可以正常工作.我尝试用'checked'替换禁用的'属性',看看其他属性是否正常工作,并且它的工作完全正常.我试过了
$("#" + childID).attr('disabled', '');
Run Code Online (Sandbox Code Playgroud)
但它也没有用.
注意:它在FF和Chrome上运行完美但在IE中不起作用.
谢谢,
如何仅使用代码检测a UIviewController中的触摸UIView(没有Interface Builder)?
我找到了touchesBegan方法,但它永远不会被调用.我没有初始化有关此方法的任何其他内容.
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
Run Code Online (Sandbox Code Playgroud) 我无意中在Eclipse项目中向CVS添加了一些动态构建的目录和文件.现在删除这些文件后,提交更改并运行构建文件显示为新(问号),但目录显示为已提交.现在我知道处理这种情况的困难方法,需要我从repo手动删除不需要的目录,但我真正想做的就是添加最不需要的dir,.cvsignore以便在提交时忽略任何文件.但是,Team->Add to .cvsignore菜单选项此时显示为灰色,如果我.cvsignore手动添加,则会忽略(缺少更好的单词).
这可以在没有清除历史记录的目录的情况下完成吗?如果是 - 怎么样?
我正在建立一个订阅服务,按时间表向我们公司的各个人发送报告.我打算通过电子邮件发送报告,我正在使用的报告系统能够导出为PDF流(而不是编写临时文件).大多数人会收到多个报告,所以我试图将它们全部附加到一封电子邮件中
List<Stream> reports = new List<Stream>();
//looping code for each users set of reports
Stream stream = ReportSource.ReportDocument.ExportToStream(PortableDocFormat)
reports.Add(stream);
stream.Flush(); //unsure
stream.Close(); //unsure
//end looping code
SmtpClient smtpClient = new SmtpClient(host, port);
MailMessage message = new MailMessage(from, to, subject, body);
foreach (Stream report in reports)
{
message.Attachments.Add(new Attachment(report, "application/pdf"));
}
smtpClient.Send(message);
Run Code Online (Sandbox Code Playgroud)
我不确定的是,我应该在将流添加到列表之后刷新并关闭流,这样可以吗?或者我之后是否需要循环列表以进行刷新和处理?我试图避免任何可能的内存泄漏.
我正在创建一个改变Button的ControlTemplate的样式(它实际上在右边添加了箭头,因此按钮看起来像下拉按钮(在wpf中缺少)).
在模板内部,我放了实际按钮(因为我需要结果仍然像按钮 - 我只能更改ContentTemplate,但我需要与箭头一起显示实际内容,并将ContentPresenter放在ContentTemplate中产生堆栈溢出 - wpf just将模板扩展到演示者并继续和箭头一起继续.
我的问题是我希望用户能够更改按钮的背景,所以我需要绑定Background="{TemplateBinding Background}".有了这个,用户必须始终提供背景,否则它将为null.为了防止这种情况,我理解我需要为后台提供默认值,所以我补充说<Setter Property="Background" Value="default Background goes here"/>
问题是,这个二传手应该是什么价值?我假设wpf的内置样式是为每个应用程序自动加载的,我已经查看了aero.normalcolor.xaml,它们提供了ButtonNormalBackground样式,后来将它用作默认按钮样式<Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>(aero.normalcolor.xaml,第47行).
正是我想要的,但是,当我使用这个setter时,找不到静态资源.然后我将其更改为DynamicResource,但在这种情况下,按钮的背景保持透明 - 不使用ButtonNormalBackground!
我应该如何提供系统的按钮外观作为默认值?谢谢!
PS:对于BorderBrush,BorderThickness - geez的dtto,似乎我不允许WPF作者一直使用的技巧:/
我的风格:
<Style TargetType="{x:Type ToggleButton}" x:Key="DropDownArrowStyle">
<Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>
<Setter Property="ToggleButton.Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<ToggleButton
x:Name="PART_ToggleButton"
Margin="{TemplateBinding Margin}"
Padding="{TemplateBinding Padding}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
IsEnabled="{TemplateBinding IsEnabled}"
IsChecked="{Binding IsChecked, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
ContextMenu="{TemplateBinding ContextMenu}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Foreground="{TemplateBinding Foreground}"
FocusVisualStyle="{TemplateBinding FocusVisualStyle}"
ClickMode="{TemplateBinding ClickMode}" …Run Code Online (Sandbox Code Playgroud) 我试图在数据检索任务需要不同时间的网站上的更新面板中异步显示数据.我想更新每个面板,以在每个任务完成后显示页面上的数据.
但是,无论我尝试什么,所有更新面板在最后一个任务完成后更改其内容.
例如:
我有两个任务:
预期的结果是在5秒后只有UpdatePanel1中的标签发生变化,但是,两个更新面板同时更新,为10秒.
两个更新面板都设置为updatemode ="Conditional",并告诉他们从客户端javascript回发.以下是上述示例的完整列表.
我在这里错过了什么?如何加载一个更新面板,然后另一个,让两个任务异步运行?
谢谢,
TM值
ASPX:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body onload="partialPostback();">
<script language="JavaScript" type="text/javascript">
function partialPostback() {
__doPostBack('UpdatePanel1', '');
__doPostBack('UpdatePanel2', '');
}
</script>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"/>
5 sec:
<asp:UpdatePanel ID="UpdatePanel1" runat="server"
UpdateMode="Conditional" OnLoad="UpdatePanel1_Load">
<ContentTemplate>
<asp:Label ID="Label2" runat="server" Text="Label"/><br />
</ContentTemplate>
</asp:UpdatePanel><br />
10 sec:
<asp:UpdatePanel ID="UpdatePanel2" runat="server"
UpdateMode="Conditional" OnLoad="UpdatePanel2_Load"> …Run Code Online (Sandbox Code Playgroud) 我想知道使用Call Keyword调用过程和在VB.NET中没有调用的优缺点?
Private Sub ProOne()
' Code Are Here
End Sub
Private Sub Calling()
ProOne() ' I would like to know pros and cons of this
Call ProOne() ' And I would like to know pros and cons of this
End Sub
Run Code Online (Sandbox Code Playgroud)
在此先感谢所有人.