在aspx页面中使用aspx用户控件的多个实例(Using multiple instances of an aspx user control in a aspx page)
我在aspx页面中使用多个aspx用户控件实例时遇到问题。 当我尝试通过Java脚本获取User控件元素值时会发生这种情况。
用户控制代码:
<script type="text/javascript"> function ucFun() { var a = document.getElementById("<%=tbName.ClientID%>"); alert(a.value); return false; } </script> <asp:Label Text="Name" runat="server" ID="lblname"></asp:Label> <asp:TextBox ID="tbName" runat="server" ></asp:TextBox> <asp:Button ID="btSubmit" runat="server" Text="Go" OnClientClick="ucFun()" />
网页表格代码
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <uc:cont runat="server" ID="ucID" /> <uc:cont runat="server" ID="Cont1" /> <uc:cont runat="server" ID="Cont2" /> </div> </form> </body> </html>
单击Go按钮时,它会显示null int he alert box,因为元素未定义。 但是,当我在窗体中有一个用户控件实例时,它正确显示文本框值。
我们有什么方法可以写这个..
I am facing a problem in using more than one instance of an aspx user control in a aspx page. This happens when I tried to fetch User control element value through Java script.
User Control Code:
<script type="text/javascript"> function ucFun() { var a = document.getElementById("<%=tbName.ClientID%>"); alert(a.value); return false; } </script> <asp:Label Text="Name" runat="server" ID="lblname"></asp:Label> <asp:TextBox ID="tbName" runat="server" ></asp:TextBox> <asp:Button ID="btSubmit" runat="server" Text="Go" OnClientClick="ucFun()" />
Web Form Code
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <uc:cont runat="server" ID="ucID" /> <uc:cont runat="server" ID="Cont1" /> <uc:cont runat="server" ID="Cont2" /> </div> </form> </body> </html>
on clicking the Go button, it displays null int he alert box, as the element is undefined. However, When I have one instance of User control in the form, it rightly displayed the text box value.
Is there any way we should write this..
原文:
最满意答案
在iOS 5中 ,您可以使用一系列图像。 首先,您需要添加一个新的类别方法:
类别
@interface UIImage (WrightsCS) +(UIImage*)animatedImageWithImages:(NSArray*)images duration:(NSTimeInterval)duration; @end
例
+(UIImage*)loadingImage { NSArray *animationFrames = [NSArray arrayWithObjects: [UIImage imageNamed:@"downloading01.png"], [UIImage imageNamed:@"downloading02.png"], [UIImage imageNamed:@"downloading03.png"], [UIImage imageNamed:@"downloading04.png"], [UIImage imageNamed:@"downloading05.png"], [UIImage imageNamed:@"downloading06.png"], [UIImage imageNamed:@"downloading07.png"], [UIImage imageNamed:@"downloading08.png"], [UIImage imageNamed:@"downloading09.png"], [UIImage imageNamed:@"downloading10.png"], [UIImage imageNamed:@"downloading11.png"], [UIImage imageNamed:@"downloading12.png"], [UIImage imageNamed:@"downloading13.png"], [UIImage imageNamed:@"downloading14.png"], [UIImage imageNamed:@"downloading15.png"], [UIImage imageNamed:@"downloading16.png"], nil]; return [UIImage animatedImageWithImages:animationFrames duration:1.0f]; }
In iOS 5, you can use a sequence of images. First you will need to add a new category method:
Category
@interface UIImage (WrightsCS) +(UIImage*)animatedImageWithImages:(NSArray*)images duration:(NSTimeInterval)duration; @end
Example
+(UIImage*)loadingImage { NSArray *animationFrames = [NSArray arrayWithObjects: [UIImage imageNamed:@"downloading01.png"], [UIImage imageNamed:@"downloading02.png"], [UIImage imageNamed:@"downloading03.png"], [UIImage imageNamed:@"downloading04.png"], [UIImage imageNamed:@"downloading05.png"], [UIImage imageNamed:@"downloading06.png"], [UIImage imageNamed:@"downloading07.png"], [UIImage imageNamed:@"downloading08.png"], [UIImage imageNamed:@"downloading09.png"], [UIImage imageNamed:@"downloading10.png"], [UIImage imageNamed:@"downloading11.png"], [UIImage imageNamed:@"downloading12.png"], [UIImage imageNamed:@"downloading13.png"], [UIImage imageNamed:@"downloading14.png"], [UIImage imageNamed:@"downloading15.png"], [UIImage imageNamed:@"downloading16.png"], nil]; return [UIImage animatedImageWithImages:animationFrames duration:1.0f]; }
相关问答
更多-
请参阅此处了解如何在iOS上使用Tesseract快速完成某些操作。 我怀疑你会得到你想要的准确性。 到目前为止,我还没有找到一个好的开源解决方案,因为iPhone相机不适合这个问题。 有几个在线API选项可以做得更好。 哦,还有一个建议的话,不要在你的情况下试图支付任何东西:) See this for how to do something quick on iOS with Tesseract. I doubt you will get the accuracy you want though. So ...
-
与缩略图电影相同的文件夹中有一个jpg。 我只用手机录制的视频进行了测试,但效果很好。 它的名称与电影名称不同,因此请获取电影所在的目录路径并迭代为.jpg,然后离开。 There is a jpg in the same folder as the the movie that is the thumbnail. I have only tested it with video recorded from the phone, but it works fine. Its not named the sa ...
-
使用DropBox SDK for Iphone从UIImageView上传图像(Upload Image from UIImageView using DropBox SDK for Iphone)[2022-01-17]
您必须首先将文件写入文件系统: NSData *data = UIImagePNGRepresentation(imageView.image); NSString *file = [NSTemporaryDirectory() stringByAppendingPathComponent:@"upload.png"]; [data writeToFile:file atomically:YES]; [DBRestClient uploadFile:@"upload.png" toPath:@"Dropb ... -
图像效果iphone sdk(image effects iphone sdk)[2022-03-21]
默认情况下,iPhone SDK(特别是CoreGraphics)不支持发光效果。 对于纸张效果,我不确定你在寻找什么。 如果您坚持SDK不支持的效果,您应该尝试找到更少的平台特定来源并使其适应iPhone: 发光和阴影效果 (Windows GDI) 另一个可能很有效的技术来源是ImageMagick来源 。 A glow effect is not supported by default within the iPhone SDK (specifically CoreGraphics). For th ... -
如何在iPhone SDK中集成Google Image Search API?(How to integrate Google Image Search API in iPhone SDK?)[2023-08-26]
阅读谷歌图片搜索API介绍的链接 并为json阅读此内容 它太容易客栈响应你会得到unescapedUrl键是你的图像所在的网址。 Read the link to get introduced with google image search api and read this for json its too easy inn response u will get unescapedUrl key is your url where image lies. -
据我所知,目前没有API可以让你做到这一点。 As far as I'm aware, there is currently no API that enables you to do this.
-
我知道这已经得到了回答,但我写了一个函数来计算ImageView中imageView相对于imageView的图像帧。 编辑:忘了最重要的。 + (CGRect) imagePositionInImageView:(UIImageView*)imageView { float x = 0.0f; float y = 0.0f; float w = 0.0f; float h = 0.0f; CGFloat ratio = 0.0f; CGFloat horiz ...
-
从iPhone OS 2.1开始,iPhone的WebKit本身就支持SVG图形。 您应该能够使用UIWebView加载SVG元素以进行显示。 这个问题提供了一些示例代码。 As of iPhone OS 2.1, the iPhone's WebKit supports SVG graphics natively. You should be able to use a UIWebView to load the SVG element for display. This question provide ...
-
iPhone SDK:将动画加载(齿轮)图像设置为UIBarButtonItem(iPhone SDK: set animated loading (gear) image to UIBarButtonItem)[2023-12-06]
尝试创建一个UIActivityIndicatorView并使用-[UIBarButtonItem initWithCustomView:]将其分配给您的按钮。 Try creating a UIActivityIndicatorView and assigning it to your button with -[UIBarButtonItem initWithCustomView:]. -
在iOS 5中 ,您可以使用一系列图像。 首先,您需要添加一个新的类别方法: 类别 @interface UIImage (WrightsCS) +(UIImage*)animatedImageWithImages:(NSArray*)images duration:(NSTimeInterval)duration; @end 例 +(UIImage*)loadingImage { NSArray *animationFrames = [NSArray arrayWithObjects: ...