小编use*_*408的帖子

使用jQuery查找元素ID包含特定文本的页面上的所有元素

我正在尝试查找页面上元素ID包含特定文本的所有元素.然后,我需要根据它们是否隐藏来过滤找到的元素.任何帮助是极大的赞赏.

search jquery wildcard filter find

119
推荐指数
4
解决办法
17万
查看次数

jquery ajax得到例子

目前我正在使用这样的post方法

$.ajax({
    type: "POST",
    url: "Servicename.asmx/DoSomeCalculation", 
  data: "{param1ID:"+ param1Val+"}",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function(msg) {
        UseReturnedData(msg.d);
    },
    error: function(err) {
        alert(err.toString());
        if (err.status == 200) {
            ParseResult(err);
        }
        else { alert('Error:' + err.responseText + '  Status: ' + err.status); }
    }
}); 
Run Code Online (Sandbox Code Playgroud)

我是否正确相信如果我使用GET请求而不是POST,行为将变为同步请求,即执行将等待直到从服务器收到响应?

有人可以告诉我一个jquery GET示例直接调用web服务的web方法吗?

更新:使用下面建议的异步标志实际上我需要这样做,这对我有用.我仍然很好奇上面的代码需要做些什么来使它成为GET请求.更改类型:"GET"没有达到预期的效果!

ajax jquery post get

13
推荐指数
2
解决办法
3万
查看次数

IE7/IE8 z-index问题

在兼容模式下运行,下面的日历将在下面的文本框后面呈现.IE8显示我需要它的日历.

我的CSS

.MyCalendar .ajax__calendar_container 
{
border:1px solid #7F9DB9; 
background-color: #ffffff; 
z-index : 1004 ;   
width:190px;
}
Run Code Online (Sandbox Code Playgroud)

覆盖日历的文本框没有设置任何z-index,尽管我已经尝试在我的服务器端代码中将z-index设置为-1,如果我检测到IE7无效的话.有什么建议? alt text http://img62.imageshack.us/img62/7127/overlay.gif

css z-index internet-explorer-8 internet-explorer-7

13
推荐指数
1
解决办法
3万
查看次数

序列化System.Globalization.CultureInfo类型的对象时检测到循环引用

我正在使用jquery来调用webservice,它返回一个包含几个表的数据集.

这工作正常,直到我需要设置我的webmethod接受参数.我在客户端反映了这一点

data: "{paramname:'" + paramval+ "'}",
Run Code Online (Sandbox Code Playgroud)

我现在在webmethod返回时收到以下错误.无论数据集中返回什么,都会发生这种情况

错误:{"消息":"在序列化类型为\ u0027System.Globalization.CultureInfo\u0027的对象时检测到循环引用.","StackTrace":"在System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o ,StringBuilder sb,Int32 depth,Hashtable objectsInUse,SerializationFormat serializationFormat)\ r \n at ... etc

当webmethod没有参数时,客户端js看起来与下面相同,除了data:line被删除.

function ClientWebService(paramval){
$.ajax({
    type: "POST",
    url: "WebService1.asmx/webmethodName", 
    data: "{paramname:'" + paramval+ "'}",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function(msg) {
        ParseResult(msg.d);
    },
    error: function(err) {
        if (err.status == 200) {
              ParseResult(err);
        }
        else { alert('Error:' + err.responseText + '  Status: ' + err.status); }
    }
}); 
Run Code Online (Sandbox Code Playgroud)

}

编辑:根据建议将请求更改为

data: {paramname: paramval},
Run Code Online (Sandbox Code Playgroud)

产生以下错误.

错误:{"消息":"无效的JSON原语:paramval.","StackTrace":"
在System.Web.Script.Serialization.JavaScriptObjectDeserializer中的System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializePrimitiveObject()\ r \n".在System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer序列化程序)的System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String输入,Int32 depthLimit,JavaScriptSerializer序列化程序)\ r …

c# jquery json web-services

7
推荐指数
1
解决办法
3万
查看次数

Web服务的正确日期时间格式

我有一个webservice,其方法是通过我的javascript中的xmlhttprequest对象调用的.该方法接受datetime参数,该参数随后转换为字符串并针对数据库运行以执行计算.

我从m_txtDateAdd获取值并发送xmlHttprequest

<asp:textbox id=m_txtDateAdd tabIndex=4 runat="server" Width="96px" Text="<%# Today %>">
</asp:textbox>
Run Code Online (Sandbox Code Playgroud)

它有一个验证器

<asp:CustomValidator id="m_DateAddValidator" runat="server" ErrorMessage="Please Enter a Valid Date" ControlToValidate="m_txtDateAdd">&#x25CF;</asp:CustomValidator>
Run Code Online (Sandbox Code Playgroud)

我的webmethod看起来像这样

[WebMethod]
public decimal GetTotalCost(DateTime transactionDate)
{
    String sqlDateString = transactionDate.Year+"/"+transactionDate.Month+"/"+transactionDate.Day;
Run Code Online (Sandbox Code Playgroud)

我使用sqlDateString作为我发送到数据库的commandtext的一部分.它是一个遗留应用程序及其内联sql,所以我没有自由设置存储过程,并在我的代码后面创建和分配参数.这有效率的90%.在m_txtDateAdd的onchange事件上调用webservice.我一次又一次地从服务器得到的响应是

System.ArgumentException:无法将25/06/2009转换为System.DateTime.System.ArgumentException:无法将25/06/2009转换为System.DateTime.

参数名称:type ---> System.FormatException:String未被识别为有效的DateTime.

   at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
   at System.DateTime.Parse(String s, IFormatProvider provider)
   at System.Convert.ToDateTime(String value, IFormatProvider provider)
   at System.String.System.IConvertible.ToDateTime(IFormatProvider provider)
   at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
   at System.Web.Services.Protocols.ScalarFormatter.FromString(String value, Type type)
   --- End of inner exception stack trace ---
   at System.Web.Services.Protocols.ScalarFormatter.FromString(String value, …
Run Code Online (Sandbox Code Playgroud)

sql web-services date-format formatexception

7
推荐指数
2
解决办法
3万
查看次数

我的程序如何确定它是在32位还是64位Windows上运行?

这是我的问题.确定应用程序运行的位体系结构的最佳方法是什么?

我想要做的是:在64位服务器上,我希望我的应用程序读取64位数据源(存储在reg密钥Software\Wow6432Node\ODBC\ODBC.INI\ODBC数据源中),如果它的32位我想读取32位数据源,(即从Software\ODBC\ODBC.INI\ODBC数据源读取).

我可能会忽略这一点,但我不想关心我的应用程序运行的模式.我只是想知道操作系统是32位还是64位.

[System.Environment.OSVersion.Platform似乎并不适合我.它在我的本地xp机器和win2k8 64位服务器上返回Win32NT(即使我的所有项目都设置为目标'任何cpu')]

c# operating-system 32bit-64bit .net-2.0

5
推荐指数
1
解决办法
1501
查看次数

来自UNC路径的html图像源

我需要将图像源设置为网络上的某个位置。

该图像位于machineName \ mappedPath \ abc.jpg。

尽管我需要它在IE v9及更高版本中运行,但它不会在任何浏览器中加载。当我检查源中的位置时,它设置为

<img src="\\machineName\mappedPath\abc.jpg">
Run Code Online (Sandbox Code Playgroud)

当我右键单击IE中的图像占位符并查看属性时,我看到地址设置为

file://machineName/mappedPath/abc.jpg
Run Code Online (Sandbox Code Playgroud)

将文件浏览器与这些路径中的任何一个一起使用都可以打开图像。

我尝试添加IP。无法添加域名,因为它不在域上。

我尝试将源设置为正下方的其他路径。我读过一些地方需要5个正斜杠,但并没有什么区别

<img src="file://\\machineName\mappedPath\abc.jpg">
<img src="file:////\\machineName\mappedPath\abc.jpg">
<img src="file://///\\machineName\mappedPath\abc.jpg">
<img src="file:////machineName/mappedPath/abc.jpg">
<img src="file://///machineName/mappedPath/abc.jpg">
<img src="\\machineName\mappedPath\abc.jpg">
Run Code Online (Sandbox Code Playgroud)

我还尝试通过添加防火墙规则来启用文件共享

https://blogs.msdn.microsoft.com/windows_azure_connect_team_blog/2011/01/20/windows-azure-connect-use-case-enable-file-sharing-on-windows-azure-vm/

附带说明一下,该路径是否必须映射为网络驱动器或将其设置为网络共享是否足够?

不是确切的来源,但这是我遇到过的非常常见的一种信息,https://jonlabelle.com/snippets/view/html/create-html-link-to-unc-path,但是对于这些信息不起作用对我来说(在IE中)

html unc imagesource

5
推荐指数
1
解决办法
5021
查看次数

Sys.InvalidOperationException:处理程序必须是函数

我有一个包含TabContainer的网页

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
...
....
<form id="form1" runat="server">
    <asp:ScriptManager ID="sm1" runat="server"></asp:ScriptManager>
    <cc1:TabContainer runat="server" ID="tbcTabContainer" OnClientActiveTabChanged="ChangeTab()"></cc1:TabContainer>
</form>
Run Code Online (Sandbox Code Playgroud)

它调用了一个js函数,此时此功能无效.

<script  type="text/javascript">
function ChangeTab()
{
    alert('Sucesss');
}
</script>
Run Code Online (Sandbox Code Playgroud)

在我的页面中加载后面的代码我创建了几个选项卡面板并将它们添加到容器中.现在,我的问题是,当我更改选项卡时,javascript警告框显示但是一旦我关闭它我得到错误

Microsoft JScript运行时错误:Sys.InvalidOperationException:处理程序必须是函数.

.net javascript c# tabs ajaxcontroltoolkit

3
推荐指数
1
解决办法
5031
查看次数

document.getElementById(仍然)不起作用

我在这里开始了一个线程document.getElementById不工作,但看起来即使所提出的建议都是有效的我仍然有问题.

我有几个复选框.当我在这里查看页面源时.document.getElementById('chk1')是唯一不为null的文件.怎么会这样?

<input id="chk0" value="JobStages###StageCode~JobCode###DRAW~1005" onclick="addRemoveRow(this.value,this.checked)" style="border-width:0px;padding:1px;margin:0px;height:14px;"  type="checkbox" />

<input id="chk1" value="JobStages###StageCode~JobCode###FEAS~1005" onclick="addRemoveRow(this.value,this.checked)" style="border-width:0px;padding:1px;margin:0px;height:14px;"  type="checkbox" />

<input id="chk2" value="JobStages###StageCode~JobCode###N/C~1005" onclick="addRemoveRow(this.value,this.checked)" style="border-width:0px;padding:1px;margin:0px;height:14px;"  type="checkbox" />
Run Code Online (Sandbox Code Playgroud)

编辑:几乎完整的代码

<tr id='rw1' onMouseOver='setHover(this,event);' class='DRAW~1005      '
    onClick='setClick(this,event);'>
    <td id='RowId_0' width=0 style='display: none'>1</td>

    <td id='PrimaryKey_0' width=0 style='display: none'>DRAW~1005</td>
    <td id='StageCode_0' width=0 style='display: none'>DRAW</td>
    <td id='Allocated_0' nowrap
        style='overflow: hidden; height: 16px; width: 136px; overflow: hidden; text-align: center; padding-left: 5px;'
        class='col1'><input id="chk0"
        value="JobStages###StageCode~JobCode###DRAW~1005"
        onclick="addRemoveRow(this.value,this.checked)"
        style="border-width: 0px; padding: 1px; margin: 0px; height: 14px;"
        type="checkbox" /></td>
    <td id='StageCode_0' nowrap
        style='overflow: …
Run Code Online (Sandbox Code Playgroud)

javascript dom

3
推荐指数
2
解决办法
2万
查看次数

何时创建自己的IEnumerable类

如果你List<T>在一个类中使用一个集合甚至是arraylist,为什么你只想实现IEnumerable并返回枚举器就可以创建自己的枚举类.我在网上看到人们创建自己的可枚举类并实现当前,movenext等的例子......

.net c# ienumerable

3
推荐指数
1
解决办法
894
查看次数

document.getElementById不起作用

我在页面上有2个chekboxes.每个行都包含在一个表格单元格中.执行document.getElementById('chk1_FEAS~1005')会返回元素,但document.getElementById('chk5_STG2~1005')为空.出于什么原因可能会发生这种情况?(我在IE 8中测试).

<input id="chk1_FEAS~1005" value="JobStages###StageCode~JobCode###FEAS~1005" onclick="addRemoveRow(this.value,this.checked)" style="border-width:0px;padding:1px;margin:0px;height:14px;"  type="checkbox" />

<input id="chk5_STG2~1005" value="JobStages###StageCode~JobCode###STG2~1005" onclick="addRemoveRow(this.value,this.checked)" style="border-width:0px;padding:1px;margin:0px;height:14px;"  type="checkbox" />
Run Code Online (Sandbox Code Playgroud)

javascript client-side

2
推荐指数
1
解决办法
4173
查看次数

在DataGrid的Selected Row中设置元素的前景颜色

我有一个DataGridTemplateColumn定义如下.如果选择了行,我需要将两个文本块的Foreground属性更改为White

<DataGrid.Columns>
<DataGridTemplateColumn  Header="User" Width="240" >
    <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <StackPanel>
                <TextBlock Margin="10,3,0,0" Foreground="#1c72c7" >
                        <Run Text="{Binding FullName, Mode=OneWay}" />
                </TextBlock>
                <Label Padding="0,0,0,0"  Margin="0,0,0,3">
                    <TextBlock Foreground="#1c72c7"  Margin="10,0,0,0" TextDecorations="Underline" Text="{Binding DisplayName}" />
                </Label>
            </StackPanel>
        </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
Run Code Online (Sandbox Code Playgroud)

我已经定义了RowStyle来更改行的背景颜色,如下所示

 <DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
    <Style.Resources>
        <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="{x:Static SystemColors.HighlightColor}" />
    </Style.Resources>

</Style>
Run Code Online (Sandbox Code Playgroud)

wpf xaml datagrid

2
推荐指数
1
解决办法
1540
查看次数

Sql游标循环花了一分钟循环遍历20行

下面循环中的代码需要一分钟才能完成.我已经删除了循环体中的所有处理/计算,试图找出所花费的时间如此之长,因此看起来只是迭代行(只有20)才需要时间.是否会将其重写为while循环增加性能,或者下面的代码是否存在固有的错误?

declare tl_cursor cursor local forward_only dynamic optimistic
for 
select EId, Date, Hrs, Code1, Code2,  TLId, Acc
from TLines where Account < 0 and Date=@magicdate
for update of Cost, Charge, Acc, RowId, ParentTLId

open tl_cursor
fetch next from tl_cursor
into @tl_eid, @tl_date, @tl_hrs, @tl_account, @tl_tlid

while @@fetch_status = 0
begin
   --Removed all calculations in there to narrow down bottleneck
NextRecord:
    update TLines set Acc = 0 where current of tl_cursor

    fetch next from tl_cursor
    into @tl_eid, @tl_date, @tl_hrs, @tl_account, @tl_timelineid …
Run Code Online (Sandbox Code Playgroud)

sql t-sql sql-server loops cursor

0
推荐指数
1
解决办法
227
查看次数