code-behind

retrieve value from javascript function in codebehind

丶灬走出姿态 提交于 2019-12-22 13:39:08
问题 How can I retrieve value from javascript function in codebehind, on page load .. javascript function like : <script type="text/javascript"> function isIFrame() { var isInIFrame = (top.location != self.location); if (isInIFrame) { return "inside"; } else { return "outside"; } } </script> and code behind like : protected void Page_Load(object sender, EventArgs e) { string resutOfExecuteJavaScript = ""; // resutOfExecuteJavaScript = isIFrame(); // from javascript if (resutOfExecuteJavaScript ==

Get specific data row in gridview?

混江龙づ霸主 提交于 2019-12-22 10:37:50
问题 How do I get the specific data row of my GridView in asp.net? I have this image here: Example: I want to get the specific data row of the studentID = 2011017997 and its CourseNo = 'CmpE 515'; how do I get their specific data? Does GridViewRow has one of that built in functions to get the data row? Here is the aspx code: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ValidateSubjectTeacher.aspx.cs" Inherits="SoftwareAnalysisAndDesign.SAD.ValidateSubjectTeacher" %> <!DOCTYPE html>

ASP.NET Dropdown List in Codebehind vs in ASPX page

戏子无情 提交于 2019-12-22 08:24:22
问题 I am generating a dropdown list in codebehind and cannot get the selectedindexchanged event to fire automatically. It works fine when put directly into the ASPX page, but I need it to be in the codebehind. This doesn't work: var deptList = new DropDownList { ID = "deptList", DataSource = departments, DataTextField = "deptname", DataValueField = "deptid", AutoPostBack = true, EnableViewState = true }; deptList.SelectedIndexChanged += new EventHandler(deptList_SelectedIndexChanged); deptList

ASP.NET - Inline vs. Code-Behind

。_饼干妹妹 提交于 2019-12-22 06:01:27
问题 I realize that by asking this question, I could have started the apocalypse, but a colleague of mine uses a lot of inline coding in their aspx pages, where as I prefer using the code-behind. Is there a right and a wrong way here? 回答1: Not unless your coding standard says otherwise. IMO code-behind helps separation of concerns, so I prefer that, but sometimes just dealing with one file is nice too. 回答2: Code-behind is the more traditional and logical place. If it works, it works, but I can't

ASP.NET - Inline vs. Code-Behind

随声附和 提交于 2019-12-22 06:01:11
问题 I realize that by asking this question, I could have started the apocalypse, but a colleague of mine uses a lot of inline coding in their aspx pages, where as I prefer using the code-behind. Is there a right and a wrong way here? 回答1: Not unless your coding standard says otherwise. IMO code-behind helps separation of concerns, so I prefer that, but sometimes just dealing with one file is nice too. 回答2: Code-behind is the more traditional and logical place. If it works, it works, but I can't

Convert a single file aspx to code behind

社会主义新天地 提交于 2019-12-21 12:05:14
问题 I'm working on a web site (not a web application) in VS 2008 .Net 3.5 and it uses the single file .aspx model where the server code is included in the head portion of the html instead of using a .aspx.cs code behind page. I'd like to quickly convert the files to use the code-behind model, but so far the only way I can do this is by removing the file, creating a new, code-behind aspx page of the same name, then manually copying in the aspx related code to the .aspx page and the server code to

Get all rows data of a JQGrid in codebehind?

北城以北 提交于 2019-12-21 05:38:09
问题 I'm adding some rows data to my JQGrid on client side with javascript : var grid = jQuery("#<%= JQGridMembers.ClientID %>"); var rowKey = grid.getGridParam("selrow"); var newRow = [{ ID: memberId, FullName: memberFullName, Percent: parseInt(percent)}]; grid.addRowData(memberId, newRow); above code works well , but How can I get all inserted rows data (in JQGrid) in code-behind? 回答1: You can get all rows from the grid by var myData = grid.jqGrid('getRowData'); or with respect of var myData =

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

社会主义新天地 提交于 2019-12-20 06:00:12
问题 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,

Setting Page Async mode to true from Code-Behind

三世轮回 提交于 2019-12-20 02:53:28
问题 Is it possible within my code-behind file to set the asynchronous mode of the page directive. I have no way of directly modifying the <%@Page %> attribute and and struggling to find a way to implement this in my code-behind. I have tried in my Page_Load method to add Page.AsyncMode = true , but it returns the following error: is inaccessible due to its protection level Is there any way to do this? Without being able to directly modify the master page? 回答1: No, you cannot change the

Change HtmlForm action in C# ASP.NET 3.5

亡梦爱人 提交于 2019-12-19 19:40:06
问题 I have a form as <form id="form" action="" method="post" runat="server"> When accessing in C# code-behind via HtmlForm form = (HtmlForm)this.FindControl("form"); and attempting to change the action with form.Attributes.Add("action","./newpage.aspx?data=data"); or form.Attributes["action"] = "./newpage.aspx?data=data"); no change is made. The form still routes to the same page. How can I dynamically change the form's action in codebehind? EXTRA DETAILS: I have a page that has a get variable.