单击自定义控制按钮的事件处理程序(Click event handler with Custom Control Button)
我正在为我的Web应用程序创建一个ASP.NET自定义控件,它基本上是一个包含在多个
<div>
元素中的ASP.NET Button控件(用于样式目的)。如何为自定义控件创建Click事件处理程序,以便我的控件充当ASP.NET按钮?
IE浏览器。
<cc:Button id="myButton" runat="server" Text="Submit" /> Sub myButton_Click(sender as object, e as EventArgs) Handles myButton.Click End Sub
I'm creating an ASP.NET Custom Control for my web application which is basically an ASP.NET Button control contained inside multiple
<div>
elements (for styling purposes).How can I create a Click event handler for my custom control so that my control acts as an ASP.NET Button?
Ie.
<cc:Button id="myButton" runat="server" Text="Submit" /> Sub myButton_Click(sender as object, e as EventArgs) Handles myButton.Click End Sub
原文:https://stackoverflow.com/questions/3283403
最满意答案
你的后端(php)代码似乎没有输出任何东西(除了几个空格)。 所以难怪JObject无法解析它:它不是json。
Your backend (php) code doesn't seem to output anything (except maybe a few whitespaces). So it's no wonder that JObject can't parse it: it isn't json.
相关问答
更多-
JSON.Net错误阅读(JSON.Net error reading)[2022-06-24]
你可以尝试使用JArray 。 这个JSON数据实际上是一个数组。 JArray v = JArray.Parse(s); 获得第一个项目。 var firstItem = v[0]["UIDClan"].ToString(); 你甚至可以使用linq var items = v.Where(x => x["UIDClan"].ToString() == "1").ToList(); You could try using a JArray. This JSON data is actually a ... -
你的后端(php)代码似乎没有输出任何东西(除了几个空格)。 所以难怪JObject无法解析它:它不是json。 Your backend (php) code doesn't seem to output anything (except maybe a few whitespaces). So it's no wonder that JObject can't parse it: it isn't json.
-
我会在整个字符串周围放一个{ } 。 即将文本更改为: {"data":[{"username":"sex","bio":"#u24e2kyu24d4u24e7pressionsninstagramsex@gmail.com","website":"","profile_picture":"http://images.ak.com/profiles/profile_37086_75sq_1363954517.jpg","full_name":"sex","id":"37086"}]} I would pu ...
-
JObject错误“对象上已存在同名属性”(JObject error “Property with the same name already exists on object”)[2023-06-19]
我刚刚通过JSLint运行您发布的JSON - 结构中有一个重复的consent字段。 它位于changes.replace.window_roof.title对象中。 I've just run your posted JSON through JSLint - there is a duplicate consent field in the structure. It's in the changes.replace.window_roof.title object. -
JObject解析注释时出错(JObject Error parsing comment)[2023-01-28]
阅读数据文件时必须更加小心。 这不是JSON。 这是JSON-P。 甚至您提供的URL也表明:请注意最后的callback=storeInfo 。 JSON-P与JSON的不同之处在于对象包含在函数调用中: // API callback storeInfo({"apiVersion":"2.1","..... }}}); 要成为一个普通的JSON,它必须是公正的 // API callback {"apiVersion":"2.1","..... }}}; 使用此服务,只需使用http://gdat ... -
如何将包含json的txt流Web请求转换为jObject?(How to convert a txt stream web request containing json to a jObject?)[2021-10-15]
问题一 - 你使用reader.ReadToEnd()两次。 首先,当您尝试读取errorMessage时,然后在下一行再次使用它。 第二次你已经阅读了所有内容。 删除行: errorMessage = JsonConvert.SerializeObject(reader.ReadToEnd()); 问题二 - 看起来你收到的数据是一个数组,所以为了阅读它你需要使用 JArray jsonResults = JArray.Parse(reader.ReadToEnd()); Problem one - ... -
你离它的工作不远。 根据JSON中是否存在condition属性实例化正确类型的对象后,可以使用serializer.Populate方法填充实例。 这应该自动处理递归。 您需要将新的JsonReader实例传递给Populate ,您可以使用jo.CreateReader()创建它。 这是转换器应该是什么样子: public class RuleConverter : JsonConverter { public override bool CanConvert(Type objectType) ...
-
Mock JsonReader单元如何测试自定义JsonConverter(How Mock JsonReader unit testing a custom JsonConverter)[2021-12-03]
使用DeserializeObject将在底层调用您的ReadJson覆盖。 [TestMethod] public void ReadJsonVerifyTypeReturned() { var testJson = CreateJsonString(); var result = JsonConvert.DeserializeObject (testJson); var resultCheck = result as ProbeResp ... -
从Json字符串中获取值(Get value from a Json string)[2023-07-03]
实际问题是,当您实际拥有一个对象数组时,您正试图将其解析为JObject 。 您可以先将其解析为数组,然后索引数组以选择唯一的对象,并选择您的CompanyID键然后将值作为int var Result = "[{\"CompanyID\":32,\"Roles\":[\"Admin\"]}]"; // Parse your Result to an Array var jArray = JArray.Parse(Result); // Index the Array and select your Com ... -
在C#中,你可以使用dynamic类似这样的东西: var json = JsonConvert.DeserializeObject(resp) 然后您可以使用以下内容访问属性: json.totalCount 。 在F#land中, 这个问题提供了一些关于如何处理dynamic对象的建议。 如果您使用FSharp.Interop.Dynamic软件包,您可以在示例中获取totalCount的值,如下所示: let value:obj = json?totalCount?Value 在我的电脑上给1L。 ...