code-behind

How to pass variable from jquery to code behind (C#)?

孤人 提交于 2019-12-02 14:41:14
问题 Here is my code, but it doesn't work (code behind gets empty string): ` <head id="Head1" runat="server"> <title>Pass Javascript Variables to Server</title> <script type="text/javascript"> // Second Step function f() { $("[id$='inpHide']").val("My JavaScript Value"); } </script> </head> <body onload="SetHiddenVariable()"> <form id="form1" runat="server"> <div> <input id="inpHide" type="hidden" runat="server" /> <asp:Button ID="btnJSValue" Text="Click" runat="server" OnClientClick="f"/> <asp

UWP: How can I attach an image to an InkCanvas?

吃可爱长大的小学妹 提交于 2019-12-02 12:29:07
I have to capture a photo with camera or loading it from file into a canvas which should be edited for highlighting some stuff on it after that saved into a folder. As for now I use this: <Grid x:Name="grid"> <Image Source="/Assets/stainless-images-110606.jpg" x:Name="ImageToEdit" Stretch="Uniform" /> <StackPanel Background="LightGreen" Width="700" Height="700" x:Name="StackPanel"> <InkCanvas x:Name="MyInkCanvas" Width="{Binding Width, ElementName=StackPanel}" Height="{Binding Height, ElementName=StackPanel}"/> </StackPanel> <InkToolbar TargetInkCanvas="{x:Bind MyInkCanvas}" Name="inkToolbar"/

Get GridView in Multiple UserControl from codebehind

浪尽此生 提交于 2019-12-02 12:17:25
IpInterfaceUC UserControl: <div id="dvChannel" runat="server" style="height: 205px; width: 550px; overflow: auto; margin-left: 5px;"> <asp:GridView ID="gvChannelUC"> </div> CodeBehind for Init int indexInterface=0; foreach (DataRow row in dtDevicesListByRole.Rows) { ctrIpInterfaceUC = (Test2.SetupGroup.Ipservice.IpInterfaceUC)LoadControl("IpInterfaceUC.ascx"); Control ctr = (Control)ctrIpInterfaceUC; ctr.ID = "device_"+ip+"_"+port+"$"+indexInterface; phDevices.Controls.Add(ctr);//PlaceHolder for add many UserControl } Html Show <div id="dvChannel"> <div id="device_192.168.2.19_3331_0

GridView RowUpdating SqlDataSource.Update from CodeBehind

為{幸葍}努か 提交于 2019-12-02 09:41:10
问题 So I am having an issue with doing an update in a Gridview during an OnRowUpdating event. What I am trying to do is set the UpdateCommand in an SqlDataSource then update using that command. The event is firing okay, but when the event is done it appears that the row never updates. C#: protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { SqlDataSource1.UpdateCommand = "UPDATE A_Table SET Something = @AValue WHERE ID = " + e.RowIndex; SqlDataSource1.Update(); } Edit:

Can't access GridView event at usercontrol by codebehind

十年热恋 提交于 2019-12-02 09:02:20
IpInterfaceUC UserControl <div id="dvChannel" runat="server"> <asp:GridView ID="gvChannelUC" OnRowCommand="gvChannelUC_RowCommand" OnSelectedIndexChanged="gvChannel_SelectedIndexChanged" /> </div> IPServices page CodeBehind if (!IsPostBack){ }else { string str_btn = Request.Form.Keys[Request.Form.Keys.Count - 1].ToString(); handleClick(str_btn); } Question It always show str_btn is null.If I click Button,It'll show button's id.But when I click Select at GridView,It show str_btn is null.It should be show GridView's id when we click select. Thanks for any explain. Try giving name attribute to

How to pass variable from jquery to code behind (C#)?

萝らか妹 提交于 2019-12-02 07:53:55
Here is my code, but it doesn't work (code behind gets empty string): ` <head id="Head1" runat="server"> <title>Pass Javascript Variables to Server</title> <script type="text/javascript"> // Second Step function f() { $("[id$='inpHide']").val("My JavaScript Value"); } </script> </head> <body onload="SetHiddenVariable()"> <form id="form1" runat="server"> <div> <input id="inpHide" type="hidden" runat="server" /> <asp:Button ID="btnJSValue" Text="Click" runat="server" OnClientClick="f"/> <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" /> </div> </form> </body> `

Invoking ASP.NET codebehind method from JavaScript

早过忘川 提交于 2019-12-02 07:40:38
Can someone please tell me how I can invoke a ASP.NET codebehind method from client-side JavaScript? Thanks Here's a very good article on how to do an Ajax call to a code-behind method: Using jQuery to directly call ASP.NET AJAX page methods I've always used Page Methods. They are pretty good. You can read the blogpost by Dave for step by step tutorial: http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/ Use an update panel control is the easiest way, but you can post the page to the server and get the result using Sys.Net.WebRequest: http://msdn.microsoft.com

Accessing dynamically created textboxes text

纵饮孤独 提交于 2019-12-02 05:04:21
问题 I have stumbled across a problem with my asp.net form. Within my form the end user chooses a number of textboxes to be dynamically created , this all works fine with the following code: protected void txtAmountSubmit_Click(object sender, EventArgs e) { int amountOfTasks; int.TryParse(txtAmountOfTasks.Text, out amountOfTasks); for (int i = 0; i < amountOfTasks; i++) { TextBox txtAddItem = new TextBox(); txtAddItem.ID = "txtAddItem" + i; txtAddItem.TextMode = TextBoxMode.MultiLine; questionNine

How to fire JS from code behind of a UserControl by an event

梦想与她 提交于 2019-12-02 04:59:08
In ASP.NET C#, I want to show an ALERT('HI') from codebehind of a UserControl but doesn't work: User Control: <asp:UpdatePanel ID="updatepanel" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click();"/> </ContentTemplate> </asp:UpdatePanel> ASP.NET Page protected void btnSubmit_Click(object sender, EventArgs e) { ScriptManager.RegisterStartupScript(this, this.GetType(), "s1", "javascript:alert('hi!')", true); } UPDATE: Forgot to say that the ASP.NET page itself is pop-out window by "prettyPhoto". there may

In ASP.NET, do inline expressions get executed before or after the code behind?

岁酱吖の 提交于 2019-12-02 04:25:42
问题 Do ASP inline expressions <% ... %> get run on the server before or after the code in the code-behind is executed? 回答1: Inline code executes after prerender page in the asp.net page life cycle. Because of this there are certain things that it can run before and certain things it can run after. Read up on the page life cycle here: http://msdn.microsoft.com/en-us/library/ms178472(v=vs.100).aspx The events that come after prerender are: PreRenderComplete SaveStateComplete Render Unload So any