Search Results

Search found 416 results on 17 pages for 'codebehind'.

Page 1/17 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • ASP.Net 3.5/4.0 CodeBehind or CodeFile?

    - by Donald Hughes
    I read through the previous post: http://stackoverflow.com/questions/73022/codefile-vs-codebehind, but I'm still confused on which I should use. It sounds like CodeFile is the newer option that should be used, yet VS2010 generates CodeBehind when creating a new Web Form.

    Read the article

  • Asp.net MVC Calling ActionLink in Codebehind

    - by SSA
    I am new to asp.net and MVC, so please go easy on me. :) I have successfully made a small MVC application. There is a database that contains a table named "Entry" and I have made Controllers for this. Also I have a view for Details and list. This works fin. My problem is in my index page. (not the view Index, but the frontpage). There I dynamically build a TreeView as a menu, with some Categories. In this menu there is under the categories there is my Entries from the database. They show up fin. I insert the entries as a TreeNode what holds the entry id and so forth. What I want is: that the entries in my treeview work as a link to the Detail view of the Entry. So if I click on a entry in the TreeView it will show the Detail page of this Entry. But I can't make it work. How to I use the <%= Html.ActionLink() % in codebehind? Or is it this the wrong way? If calling the view or controller in codebehind is the wrong way to do it. Then how? Thanks in advance.

    Read the article

  • Set Validation Tooltip in CodeBehind instead of XAML

    - by KrisTrip
    I would like to know how to translate the following code to codebehind instead of XAML: <Style.Triggers> <Trigger Property="Validation.HasError" Value="true"> <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/> </Trigger> </Style.Triggers> The part I can't figure out is the Path portion. I have the following but it doesn't work: new Trigger { Property = Validation.HasErrorProperty, Value = true, Setters = { new Setter { Property = Control.ToolTipProperty, // This part doesn't seem to work Value = new Binding("(Validation.Errors)[0].ErrorContent"){RelativeSource = RelativeSource.Self} } } } Help?

    Read the article

  • ModalPopup CodeBehind Function Wait For User Response

    - by Snave
    I have set up a function which returns an enum of the button that the user clicked in the ModalPopup. I have a variable of type enum to store which button the user clicks in the button click event. In this function, I call the ModalPopupExtender's Show() method. My problem is, the function finishes out and returns the default enum (which is "none" since no button was clicked yet) before the ModalPopup can be shown and store which button the user clicks. So without changing the function to a method and using a different way to store the user's button click, how can I pause the function after the Show() method of the MPE has been called and wait for the user to click a button? Edit(11/20/2009): Clarification: On the aspx page, I include a ScriptManager, PlaceHolder, and an asp:Button with a codebehind click event. What I want is to click the button, then in the click event handler, I want to call a custom static class function that returns a variable. One of the arguments it takes is the PlaceHolder. The function creates all the necessary controls in the PlaceHolder needed to display a ModalPopup. It calls the created ModalPopupExtender's Show() method. What should happen: At this point is the ModalPopup gets displayed, the user clicks a button, that button's event handler fires, the button sets a variable indicating that it was clicked, it then calls the ModalPopupExtender's .Hide() method, and then the function returns the variable that indicates which button was clicked. We then return to the event handler from the original button that was clicked and the programmer can then perform some logic based on what variable was returned. Crux: When the ModalPopupExtender's .Show() method gets called, it does not display the ModalPopup until AFTER the function returns a default variable (because no button was clicked yet) and after the event handler from the original button that was clicked ends. What I need: After the ModalPopupExtender's .Show() method is called, I need the ModalPopup to get displayed immediately and I need the function to wait for a button click to be made from the ModalPopup. My thoughts: Some PostBack needs to be made to the page telling it to update and display the ModalPopup Panel. Then maybe a while loop can be run in the function that waits for a button to be clicked in the ModalPopup.

    Read the article

  • How to change values of ListView elements in Codebehind

    - by Viredae
    Hello, I'm trying to create a table with Listview and one of the fields I'm using is supposed to show a hyperlink to a more detailed view of the data shown, how I want to do that is by using FindControl on the ID of that item and then changing the value into a hyperlink of the detailed view page with a querystring attached, the problem is that I have no idea how to re-insert that data back into the listview field, which looks something like this: <ItemTemplate> <td> <asp:Label ID="ViewLinkLabel" runat="server" Text='[insert Link Here]' /> </td> </ItemTemplate> Please bear in mind that I'm still an amateur in ASP.net, and if any of this seems too convoluted when there's a much easier to do this that I don't know about. Thank you

    Read the article

  • Control within ascx is null when ascx is added from codebehind

    - by Snoop Dogg
    I am having difficulties how to construct my question, but if I have to put it simply the situation is that I have categories of products. I have an aspx with a repeater on the left that lists the categories. And I want the products to be listed on the right. Category number is variable so I made an ascx with a DataList in it. When I try to do foreach category, ascx = new ascx(); then the DataList within this ascx control is null. ps: what I want to do is to preload all the products (thre is not much) and hide the divs and fadein fadeout them using jQuery when a category div is clicked. rightnow it is using jQuery.load(); and I don't like how the images load, cuz they download from top to bottom. Progressive gifs alsdo not an option. site demo is here http://techlipse.net/test/ledart Thanks a lot in advance...

    Read the article

  • Dynamically creating an ImageMap (clickable area on image) in WPF using codebehind.

    - by Thomas Stock
    Hi, I'm trying to create "imagemaps" on an image in wpf using codebehind. See the following XML: <Button Type="Area"> <Point X="100" Y="100"></Point> <Point X="100" Y="200"></Point> <Point X="200" Y="200"></Point> <Point X="200" Y="100"></Point> <Point X="150" Y="150"></Point> </Button> I'm trying to translate this to a button on a certain image in my WPF app. I've already did a part of this, but I'm stuck at setting the Polygon as the button's "template": private Button GetAreaButton(XElement buttonNode) { // get points PointCollection buttonPointCollection = new PointCollection(); foreach (var pointNode in buttonNode.Elements("Point")) { buttonPointCollection.Add(new Point((int)pointNode.Attribute("X"), (int)pointNode.Attribute("Y"))); } // create polygon Polygon myPolygon = new Polygon(); myPolygon.Points = buttonPointCollection; myPolygon.Stroke = Brushes.Yellow; myPolygon.StrokeThickness = 2; // create button based on polygon Button button = new Button(); ????? } I'm also unsure on how to add/remove this button to/from my image, but I'm looking into that. Any help is appreciated.

    Read the article

  • How to reference the same CodeBehind class from multiple .aspx files (and be able to pre-compile the

    - by thelsdj
    I have a set of aspx pages that each live in their own directory and reference a single aspx.cs code behind file. This has worked fine previously because I never tried to pre-compile the site. IIS must have individually compiled each aspx, linking them to the contents of App_Code but never referencing more than one aspx at a time. Now that I'm trying to pre-compile the website using Web Deployment Projects I keep getting errors about the same class being found in multiple assemblies. I can't just drop the aspx.cs in App_Code and subclass it because it wouldn't be able to find the controls on the .aspx pages when compiling. Maybe I could explicitly define every control on the page in the .cs? But would that allow them to be wired up correctly? Any other ideas on how I can reference the same Page class from multiple .aspx pages and be able to pre-compile the entire website?

    Read the article

  • How do you modify a modal popup from ASP codebehind instead of letting it close?

    - by user328422
    I'm using SimpleModal to create a popup on an ASP.net application. The OK button calls a server-side function - and based on the resulta of that function I'd like to modify the popup (make some things visible, etc.) instead of letting it close. If that's too difficult, I'd like to open the popup again without the user having to re-click on anything. I'm just not sure what the best way to do this is. Currently the OK button in the popup looks like this: <asp:ImageButton ID="submitInfoBtn" OnClick="btnSubmitInfo_Click" ImageUrl="css/assets/btn_ok.png" runat="server"/> and there is nothing defined that tells anything that the OK button should close the popup (the Cancel button has class="simplemodal-close", so I would expect it to do just that, but not the OK button) - anyone have any ideas on the best way through this? Thanks in advance!!

    Read the article

  • C# (ASP.Net) Linking selection values to constants in Codebehind

    - by jasonvogel
    ASPX Code <asp:RadioButtonList ID="rbServer" runat="server" > <asp:ListItem Value=<%=ServerDeveloper%>> Developer </asp:ListItemv <asp:ListItem Value="dev.ahsvendor.com"> dev.test.com</asp:ListItem> <asp:ListItem Value="staging.ahsvendor.com"> staging.test.com</asp:ListItem> </asp:RadioButtonList> ASPX.CS - Codebehind const string ServerDeveloper = "developer"; ASPX Error: Code blocks are not supported in this context. Question: So what is the correct way to tie an dropdown/radio buttion/... ASPX value to a constant that is shared with the CodeBehind code? I know that I could do rbServer.Add.Item("developer") [from the CodeBehind], but is there a way to achieve it from the Presentation side of things?

    Read the article

  • IIS6 Indexing Service indexing asp.net codebehind (.aspx.cs) files

    - by Patrick F
    I've setup a few catalogs on an Windows Server 2003 IIS6 install, each tracking files within a website. In the Properties - Generation Dialog for each catalog, 'Index files with unknown extensions' is turned OFF. 'Inherit above settings from Service' in that dialog is also turned off. However, the index is returning results for .cs files, along with abstracts for those files. I've emptied and restarted the catalogs but the files are still appearing. My understanding was the Indexing Service would by default only index HTML, ASCII, and Office Documents. What's going on?

    Read the article

  • WPF Datagrid Column Width codebehind

    - by mikemuhl
    Hi, i would like to replace the following xaml code : <Custom:DataGridTextColumn Header=" " Width="*"/>in codebehind. This xaml code fills my header to the end with my style.. this is what i want to get |name | number | this area uses "mystyle" end of grid -| this is what i now get : |name | number | unstyled area! end of grid -| as u see, i would like to fill the unstyled area with my style, done this with xaml: now need in cb pls ;)

    Read the article

  • ASP.NET: Enumerating header elements from codebehind

    - by JamesBrownIsDead
    On Page_Load() in the codebehind, I'd like to enumerate all the <link> tags. The purpose being I want want to add a <link> to a CSS file if it isn't specified in the Page's markup. How can I do this? I'm thinking I should be able to use LINQ on the collection of elements in the header, no? Here's my pseudocode: var pageAlreadyContainsCssLink = false; foreach(var control in this.Header.Controls) { if (control.TagName == "link" && control.Attributes["href"] == "my_css_file.css") { pageAlreadyContainsCssLink = true; break; } } if (pageAlreadyContainsCssLink) { // Don't add <link> element return; } // Add the <link> to the CSS this.AddCssLink(...);

    Read the article

  • UpdatePanel codebehind error "Page cannot be null"

    - by Nandoviski
    Hi guys, i'm trying create a updatepanel for my controls in a codebehind. But i get the follow error: Page cannot be null. Please ensure that this operation is being performed in the context of an ASP.NET request. My code: List<Control> novoControl = new List<Control>(); control.Controls.ForEach<Control>(c => novoControl.Add(c)); control.Controls.Clear(); // This control is a contentplaceholder of my masterpage control.Controls.Add(IcpScriptManager); //Add ScriptManager in the page foreach (Control item in novoControl) { UpdatePanel up = new UpdatePanel(); up.ID = "up_" + item.ID; up.ChildrenAsTriggers = true; up.UpdateMode = UpdatePanelUpdateMode.Conditional; up.ContentTemplateContainer.Controls.Add(item); control.Controls.Add(up); //ERROR happens here } Any ideia?? Thanks, Fernando

    Read the article

  • how to pass the strMessage (from codebehind to the script) to get the alert message

    - by Ranjana
    how to pass the strMessage (from codebehind to the script) to get the alert message i.e if my strmessage from code behind is hi, then i need You Have Used already the message : hi My code... <script type="text/javascript"> var strFileName; function alertShowMessage() { alert("You Have Used already the message :"+ <%=strFileName %>+ "); } </script> datatable dtChkFile =new datatable(); dtChkFile = objutility.GetData("ChkFileName_SMSSent", new object[] {"rahul"}).Tables[0]; if (dtChkFile.Rows.Count > 0) { for (int i = 0; i < dtChkFile.Rows.Count; i++) { strMessage= dtChkFile.Rows[i]["Message"].To); } }

    Read the article

  • How to replace a codebehind method with an aspx method using ternary operator

    - by user466663
    I have an asp:hyperlink control as part of a gridview template. The code in the aspx page is given below: asp:HyperLink runat="server" ID="lnkEdit" ToolTip="Edit article" NavigateUrl='<%# GetUrl(Eval("ID").ToString(), Eval("CategoryID").ToString()) %' ImageUrl="~/Images/Edit.gif" The NavigateUrl value is obtained from the codebehind method GetUrl(string, string). The code works fine and is as follows: protected string GetUrl(string id, string categoryID) { var CategoryID = string.Empty; if (!String.IsNullOrEmpty(Request.QueryString["CatID"])) { CategoryID = Request.QueryString["CatID"].ToString(); } else if (!String.IsNullOrEmpty(categoryID)) { CategoryID = categoryID; } return "~/TBSArticles/WriteOrEditArticle.aspx?ID=" + id + "&CatID=" + CategoryID; } I want to replace the code behind method by using a ternary operator within the aspx page. I tried something like below, but didn't work: asp:HyperLink runat="server" ID="lnkEdit" ToolTip="Edit article" NavigateUrl='<%# "~/TBSArticles/WriteOrEditArticle.aspx?ID=" + Eval("ID") + "&CatID=" + Eval(this.Request.QueryString["CatID"].ToString()) != ""? this.Request.QueryString["CatID"] : Eval("CategoryID")) %' ImageUrl="~/Images/Edit.gif" Any help will be greatly appreciated. Thanks

    Read the article

  • Set Server Side OnClick() event Programmatically

    - by Corey O.
    I am looking for a way to programmatically set the OnClick event handler for a TableCell object. The ASP equivalent of what I'm trying to do will look like this: <asp:TableCell OnClick="clickHandler" runat="server">Click Me!</asp:TableCell> In the above example, "clickHandler" is a server-side function defined in the .cs CodeBehind. public virtual void clickHandler(object sender, EventArgs args) {...} However, for my situation, this TableCell object needs to be created dynamically, so setting it in an ASP tag is not an option. I am trying to do something like the following in the CodeBehind: System.Web.UI.WebControls.TableRow row = new System.Web.UI.WebControls.TableRow(); System.Web.UI.WebControls.TableCell cell = new System.Web.UI.WebControls.TableCell(); cell.Text = "Click Me!"; cell.Attributes.Add("onClick", "clickHandler"); row.Cells.Add(cell); Unfortunately, in this situation: cell.Attributes.Add("onClick", "clickHandler"); the "clickHandler" only works as a client-side javascript function. What I'm looking for is a way to link the server-side clickHandler() function, defined in the .cs CodeBehind, to this table cell. After an afternoon of searching, I have been unable to come up with a working solution. Thanks in advance for any help.

    Read the article

  • Set ContentTemplate in CodeBehind: XamlParseException 2260 Error

    - by user362215
    Hi, I'd like to change the ContentTemplate of a ContentPresenter in the CodeBehind file. But if I run the Silverlight 4 application a XamlParseException with the error code 2260 occures. foreach (ContentPresenter item in Headers) { item.ContentTemplate = Parent.UnselectedHeaderTemplate; } if ((index >= 0) && (index < Headers.Count)) { ContentPresenter item0 = (ContentPresenter)Headers[index]; item0.ContentTemplate = Parent.SelectedHeaderTemplate; } If I do only the foreach code without the code in the "if", it works. And if I only do the code in the "if" without the foreach it works too. But togheter (the "if"-code and the foreach-code) it doesn't work. I have no idea why it doesn't work. The two templates look like this: <Setter Property="UnselectedHeaderTemplate"> <Setter.Value> <DataTemplate> <ContentControl Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}" Margin="10,-10" FontSize="72" Foreground="#FF999999" CacheMode="BitmapCache"/> </DataTemplate> </Setter.Value> </Setter> <!-- SelectedHeader template --> <Setter Property="SelectedHeaderTemplate"> <Setter.Value> <DataTemplate> <ContentControl Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}" Margin="10,-10" FontSize="72" Foreground="{TemplateBinding Foreground}" CacheMode="BitmapCache"/> </DataTemplate> </Setter.Value> </Setter> If you have an idea what problem is please tell me.

    Read the article

  • Pass Parameter to Subroutine in Codebehind

    - by Sanjubaba
    I'm trying to pass an ID of an activity (RefNum) to a Sub in my codebehind. I know I'm supposed to use parentheses when passing parameters to subroutines and methods, and I've tried a number of ways and keep receiving the following error: BC30203: Identifier expected. I'm hard-coding it on the front-end just to try to get it to pass [ OnDataBound="FillSectorCBList("""WK.002""")" ], but it's obviously wrong. :( Front-end: <asp:DetailsView ID="dvEditActivity" AutoGenerateRows="False" DataKeyNames="RefNum" OnDataBound="dvSectorID_DataBound" OnItemUpdated="dvEditActivity_ItemUpdated" DataSourceID="dsEditActivity" > <Fields> <asp:TemplateField> <ItemTemplate> <br /><span style="color:#0e85c1;font-weight:bold">Sector</span><br /><br /> <asp:CheckBoxList ID="cblistSector" runat="server" DataSourceID="dsGetSectorNames" DataTextField="SectorName" DataValueField="SectorID" OnDataBound="FillSectorCBList("""WK.002""")" ></asp:CheckBoxList> <%-- Datasource to populate cblistSector --%> <asp:SqlDataSource ID="dsGetSectorNames" runat="server" ConnectionString="<%$ ConnectionStrings:dbConn %>" ProviderName="<%$ ConnectionStrings:dbConn.ProviderName %>" SelectCommand="SELECT SectorID, SectorName from Sector ORDER BY SectorID"></asp:SqlDataSource> </ItemTemplate> </asp:TemplateField> </Fields> </asp:DetailsView> Code-behind: Sub FillSectorCBList(ByVal RefNum As String, ByVal sender As Object, ByVal e As System.EventArgs) Dim SectorIDs As New ListItem Dim myConnection As String = ConfigurationManager.ConnectionStrings("dbConn").ConnectionString() Dim objConn As New SqlConnection(myConnection) Dim strSQL As String = "SELECT DISTINCT A.RefNum, AS1.SectorID, S.SectorName FROM Activity A LEFT OUTER JOIN Activity_Sector AS1 ON AS1.RefNum = A.RefNum LEFT OUTER JOIN Sector S ON AS1.SectorID = S.SectorID WHERE A.RefNum = @RefNum ORDER BY A.RefNum" Dim objCommand As New SqlCommand(strSQL, objConn) objCommand.Parameters.AddWithValue("RefNum", RefNum) Dim ad As New SqlDataAdapter(objCommand) Try [Code] Finally [Code] End Try objCommand.Connection.Close() objCommand.Dispose() objConn.Close() End Sub Any advice would be great. I'm not sure if I even have the right approach. Thank you!

    Read the article

  • Setting hidden input value in Javascript, then accessing it in c# codebehind

    - by Siegesmith
    Thank you for reading my question. I have been trying to set the value of a hidden input by using Javascript and then access the value from within my C# codebehind. When I run the code that is copied below, the value that is assigned to assignedIDs is "", which I assume is the default value for a hidden input. If I manually set the value in the html tag, then assignedIDs is set to that value. This behavior suggests to me that the value of the input is being reset (re-rendered?) between the onClientClick and onClick events firing. I would appreciate any help with the matter. I have spent hours trying to solve what seems like a very simple problem. html/javascript: <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Admin Page - Manage Tasks</title> <script language="javascript" type="text/javascript"> function PopulateAssignedIDHiddenInput() { var source = document.getElementById('assignedLinguistListBox'); var s = ""; var count = source.length; for (var i = count - 1; i >= 0; i--) { var item = source.options[i]; if (s == "") { s = source.options[i].value; } else { s = s.concat(",",source.options[i].value); } } document.getElementById('assignedIDHiddenInput').Value = s; // I have confirmed that, at this point, the value of // the hidden input is set properly } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:Panel id="EditMode" runat="server"> <table style="border: none;"> <tr> <td> <asp:Label ID="availableLinguistLabel" runat="server" Text="Available"></asp:Label><br /> <asp:ListBox ID="availableLinguistListBox" runat="server" Rows="10" SelectionMode="Multiple"></asp:ListBox> </td> <td> <input type="button" name="right" value="&gt;&gt;" onclick="Javascript:MoveItem('availableLinguistListBox', 'assignedLinguistListBox');" /><br /><br /> <input type="button" name="left" value="&lt;&lt;" onclick="Javascript:MoveItem('assignedLinguistListBox', 'availableLinguistListBox');" /> </td> <td> <asp:Label ID="assignedLinguistLabel" runat="server" Text="Assigned To"></asp:Label><br /> <asp:ListBox ID="assignedLinguistListBox" runat="server" Rows="10" SelectionMode="Multiple"></asp:ListBox> </td> </tr> </table> //-snip- <asp:Button ID="save_task_changes_button" runat="server" ToolTip="Click to save changes to task" Text="Save Changes" OnClick="save_task_changes_button_click" OnClientClick="Javascript:PopulateAssignedIDHiddenInput()" /> </asp:Panel> <!-- Hidden Inputs --> <!-- Note that I have also tried setting runat="server" with no change --> <input id="assignedIDHiddenInput" name="assignedIDHiddenInput" type="hidden" /> </div> </form> </body> c# protected void save_task_changes_button_click(object sender, EventArgs e) { string assignedIDs = Request.Form["assignedIDHiddenInput"]; // Here, assignedIDs == ""; also, Request.Params["assignedIDHiddenInput"] == "" // -snip- }

    Read the article

  • Setting hidden input value in Javascript, then accessing it in codebehind

    - by Siegesmith
    I have been trying to set the value of a hidden input by using Javascript and then access the value from within my C# codebehind. When I run the code that is copied below, the value that is assigned to assignedIDs is "", which I assume is the default value for a hidden input. If I manually set the value in the html tag, then assignedIDs is set to that value. This behavior suggests to me that the value of the input is being reset (re-rendered?) between the onClientClick and onClick events firing. I would appreciate any help with the matter. I have spent hours trying to solve what seems like a very simple problem. html/javascript: <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Admin Page - Manage Tasks</title> <script language="javascript" type="text/javascript"> function PopulateAssignedIDHiddenInput() { var source = document.getElementById('assignedLinguistListBox'); var s = ""; var count = source.length; for (var i = count - 1; i >= 0; i--) { var item = source.options[i]; if (s == "") { s = source.options[i].value; } else { s = s.concat(",",source.options[i].value); } } document.getElementById('assignedIDHiddenInput').Value = s; // I have confirmed that, at this point, the value of // the hidden input is set properly } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:Panel id="EditMode" runat="server"> <table style="border: none;"> <tr> <td> <asp:Label ID="availableLinguistLabel" runat="server" Text="Available"></asp:Label><br /> <asp:ListBox ID="availableLinguistListBox" runat="server" Rows="10" SelectionMode="Multiple"></asp:ListBox> </td> <td> <input type="button" name="right" value="&gt;&gt;" onclick="Javascript:MoveItem('availableLinguistListBox', 'assignedLinguistListBox');" /><br /><br /> <input type="button" name="left" value="&lt;&lt;" onclick="Javascript:MoveItem('assignedLinguistListBox', 'availableLinguistListBox');" /> </td> <td> <asp:Label ID="assignedLinguistLabel" runat="server" Text="Assigned To"></asp:Label><br /> <asp:ListBox ID="assignedLinguistListBox" runat="server" Rows="10" SelectionMode="Multiple"></asp:ListBox> </td> </tr> </table> //-snip- <asp:Button ID="save_task_changes_button" runat="server" ToolTip="Click to save changes to task" Text="Save Changes" OnClick="save_task_changes_button_click" OnClientClick="Javascript:PopulateAssignedIDHiddenInput()" /> </asp:Panel> <!-- Hidden Inputs --> <!-- Note that I have also tried setting runat="server" with no change --> <input id="assignedIDHiddenInput" name="assignedIDHiddenInput" type="hidden" /> </div> </form> </body> c# protected void save_task_changes_button_click(object sender, EventArgs e) { string assignedIDs = Request.Form["assignedIDHiddenInput"]; // Here, assignedIDs == ""; also, Request.Params["assignedIDHiddenInput"] == "" // -snip- }

    Read the article

  • Reference custom list form fields from code behind and automatically fill them with values.

    - by Janis Veinbergs
    Hello. I`v made my custom NewForm.aspx for my list and I want to add some custom code to it. So I inherit that form from my own class: public class MyCustomNewForm : Microsoft.SharePoint.WebPartPages.WebPartPage Now I want to reference some of available fields to automatically fill them for user. (Javascript won't help here as I have to get some data from other lists). But I have no idea how do I reference these fields from codebehind files. The code for control field is written (well, it was generated by Sharepoint Designer when using command Insert SharePoint Controls Custom List Form...) in .aspx page like this: <SharePoint:FormField runat="server" id="ff1{$Pos}" ControlMode="New" FieldName="Title" __designer:bind="{ddwrt:DataBind('i',concat('ff1',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Title')}"/> When looking at id at runtime, it is insanely long So how do i reference fields, so I could set Text property on them in my codebehind file?

    Read the article

  • the name 'controlname' does not exist in the current context

    - by zohair
    Hi, I have a web application that I'm working on(ASP.NET2.0 with C#)[Using VS2005]. Everything was working fine, and all of a sudden I get the error: Error 1 The name 'Label1' does not exist in the current context and 43 others of the sort for each time that I used a control in my codebehind of the page. This is only happening for 1 page. And it's as if the codebehind isn't recognizing the controls. Another interesting thing is that the intellisense isn't picking up any of the controls either.. I have tried to clean the solution file, delete the obj file, exclude the files from the project then re-add them, close VS and restart it, and even restart my computer, but none of these have worked. Please Help. Thank you

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >