Search Results

Search found 124 results on 5 pages for 'pageload'.

Page 5/5 | < Previous Page | 1 2 3 4 5 

  • Passing Multiple values Through Query String?

    - by Googler
    Hi all, I tried to pass more than one value through Query String from page1.aspx to page2.aspx. This is my Query string in the Grid View <a href="javascript:void(0);" onclick='javascript:window.open("Update.aspx?Regno= <%#Eval ("ID") %>'+ ","'&Fn=<%#Eval ("FIRSTNAME") %>' +", "'&Ln=<%#Eval ("LASTNAME") %>'")';> Edit</a> On My Page2.aspx, my code behind on PageLoad is: if (Page.IsPostBack) return; string id = Request.QueryString["ID"]; string Firstname = Request.QueryString["FIRSTNAME"]; string LastName = Request.QueryString["LASTNAME"]; My Visual Studio IDE shows a syntax error on this query string. I dont know the exact way to pass multiple values through Query String. How to make it work? Can anyone pls help me on this.. Which is the right syntax to pass multiple query string?

    Read the article

  • gridview image column problem

    - by jame
    Work on vs05 C# asp.net .My SQL Syntax is :**** if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Images]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[Images] GO CREATE TABLE [dbo].[Images] ( [ID] [numeric](18, 0) IDENTITY (1, 1) NOT NULL , [ImageName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Image] [image] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO I want to show this Images table values in a grid view.....I do it ...but the image value can not show ....asp.net syntax for gridview is <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False"> <Columns> <asp:BoundField DataField="ImageName" HeaderText="ImageName" /> <asp:TemplateField HeaderText="Image"> <EditItemTemplate> <asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval("Image") %>'></asp:TextBox> </EditItemTemplate> <ItemTemplate> <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("Image") %>' /> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> i write the below code on pageload event. i want images table values must shown when the page is load... string strSQL = "Select * From Images"; DataTable dt = clsDB.getDataTable(strSQL); this.GridView2.DataSource = dt; this.GridView2.DataBind(); Why not i get the image on my image column of the gridview.....what's the problem is how to solve?

    Read the article

  • javascript mouse cursor change on page load in firefox browser 3.5

    - by Amit
    Hi in case of full page submit a trasparent div id coming and changing the cursor to 'wait' . Now when the page is getting submitted and new page is coming up cursor still remains to 'wait' not changing to default until mouse is moved in Firefox Here is simple html click on show button div is coming when user move mouse over the div cursor is changing as wait cursor. Now when this page is loaded again pressing F5 cursor remain as wait cursor in firefox its working fine in IE is there any way to make the cursor as default on pageload in Firefox <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <style> body{ cursor:default; } </style> <script src="js/jquery.js"> </script> <script> var test = true; $(document).ready(function(){ $('#maindiv').css('display','none') }); function showDiv(){ $('#maindiv').css('display','block') } </script> </head> <body> <div id="divBody" style="background-color:red;width:500px;height:500px" >aa <div id="maindiv" style="background-color:#999999;height:100$;width:400px;height:400px;cursor:wait"> sss </div>aa </div> <input type="button" value="show" onclick="showDiv()"/> </body> </html>

    Read the article

  • Could DataGridView be this dumb? or its me?lol

    - by Selase
    Am trying to bind data to a dropdown list on pageload based on a condition. Code explains further below. public partial class AddExhibit : System.Web.UI.Page { string adminID, caseIDRetrieved; DataSet caseDataSet = new DataSet(); SqlDataAdapter caseSqlDataAdapter = new SqlDataAdapter(); string strConn = WebConfigurationManager.ConnectionStrings["CMSSQL3ConnectionString1"].ConnectionString; protected void Page_Load(object sender, EventArgs e) { adminID = Request.QueryString["adminID"]; caseIDRetrieved = Request.QueryString["caseID"]; if (caseIDRetrieved != null) { CaseIDDropDownList.Text = caseIDRetrieved; //CaseIDDropDownList.Enabled = false; } else { try { CreateDataSet(); DataView caseDataView = new DataView(caseDataSet.Tables[0]); CaseIDDropDownList.DataSource = caseDataView; CaseIDDropDownList.DataBind(); } catch (Exception ex) { string script = "<script>alert('" + ex.Message + "');</script>"; } } } The CreateDataset method that is called in the if..else statement is contains the following code. private void CreateDataSet() { SqlConnection caseConnection = new SqlConnection(strConn); caseSqlDataAdapter.SelectCommand = new SqlCommand("Select CaseID FROM Cases", caseConnection); caseSqlDataAdapter.Fill(caseDataSet); } However when i load the page and as usual the condition that is supposed to bid the data is met, the gridview decides to displays as follows... IS IT ME OR ITS THE DATAGRID?...??

    Read the article

  • Details View and integration with TinyMCE <%@ Page validateRequest="false" %>

    - by GibboK
    I use TinyMCE in a DetailView in in EDIT MODE. I would like to know if there is a solution which can prevent Request Validation to trigger an error WITHOUT USING <%@ Page validateRequest="false" %> for my page. The only way I found out at the moment is to encode TextBox used by TinyMCE using option: "xml" tinyMCE.init({ encoding: "xml", In this way Request Validation does not trigger error but at the time to read the data in the TextBox the result it is Encoded. I also tried to Decode on PageLoad the content of the TextBox using this code myTextBox.Text = HttpUtility.HtmlDecode(myTextBox.Text) But the result is not as expected, so I can visualize it just Encoded text. Any Ideas? Thanks UPDATE I found a solution to my problem. I added in _DataBound event for the DetailsView this code TextBox myContentAuthor = (TextBox)uxAuthorListDetailsView.FindControl("uxContentAuthorInput"); myContentAuthor.Text = HttpUtility.HtmlDecode(myContentAuthor.Text); So on DataBound event, (should work even on post back) the content will be decodene for textbox tinymce. Here how should work: 01 - TinyMCE ESCAPE data inserted in textbox using function encoding: "xml", 02 - Data has been stored as ESCAPED 03 - To read the data and add its content to a TextBox where apply TinyMCE use in DATABOUND EVENT for DetailView and HttpUtility.HtmlDecode (so it will look decoded) 04 - You can modify content in the textbox in edit mode. On post back TinyMCE will encoded again using encoding: "xml" an so on Hope guys can help some one else. But please give me your comment on this solution thanks! Mybe you come up with more elegant solution! :-)

    Read the article

  • Passing in extra parameters in a URL

    - by Scott Atkinson
    I have the below column on my table what gets binded on pageload, the parameters in there work fine but i need to add an additional parameter which is the fullname which is the next column along but im having trouble figuring our the syntax, here is my ASP <asp:TemplateField HeaderText="ID"> <ItemTemplate> <asp:HyperLink ID="hyperLeadID" runat="server" NavigateUrl='<%#Eval("ID","/documents/Q-Sheet.aspx?LeadID={0}&isHappyCallReferral=yes&isHappyName={1}") %>' Text='<%#Eval("ID")%>'></asp:HyperLink> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Referral Name"> <ItemTemplate> <asp:Label ID="lblRefName" CssClass="gvItem" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Name") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> As you can see at the end of ID column i have added isHappyName={1} which i assumed it would select the next column along as it starts at 0 but it keeps throwing an error which is "Index (zero based) must be greater than or equal to zero and less than the size of the argument list." Can someone help me to pass the usersname through the URL Thanks

    Read the article

  • validation controls are not validating on enabling on client side using java script, plz guide

    - by haansi
    Hi, As per requirement I disabled all validation controls in page on PageLoad event in server side. On clicking submit button I want to activate them and validate the page and if the page is ok submit other wise not. I am able to enable all validaters but one thing that I am unable to understand is that they do not validate the page. I set alerts and check they are being enabled but they do not validate the page and let the page submit. I am sorry I couldn't get where I am wrong, may be there need to call some validation method as well or I should prevent default behavior of button. please guide me. Below is my script: <script type="text/javascript"> function NextClicked() { var _ddlStatus = document.getElementById("<%=ddlEmpStatus.ClientID%>"); var _selectedIndex = _ddlStatus.selectedIndex; if (_selectedIndex == 0) { alert("Nothing selected"); }<br/> else<br/> if (_selectedIndex == 1) { for (i = 0; i < Page_Validators.length; i++) { Page_Validators[i].Enabled = true; } } } </script> thanks in anticipation.

    Read the article

  • Best way to carry & modify a variable through various instances and functions?

    - by bobsoap
    I'm looking for the "best practice" way to achieve a message / notification system. I'm using an OOP-based approach for the script and would like to do something along the lines of this: if(!$something) $messages->add('Something doesn\'t exist!'); The add() method in the messages class looks somewhat like this: class messages { public function add($new) { $messages = $THIS_IS_WHAT_IM_LOOKING_FOR; //array $messages[] = $new; $THIS_IS_WHAT_IM_LOOKING_FOR = $messages; } } In the end, there is a method in which reads out $messages and returns every message as nicely formatted HTML. So the questions is - what type of variable should I be using for $THIS_IS_WHAT_IM_LOOKING_FOR? I don't want to make this use the database. Querying the db every time just for some messages that occur at runtime and disappear after 5 seconds just seems like overkill. Using global constants for this is apparently worst practice, since constants are not meant to be variables that change over time. I don't even know if it would work. I don't want to always pass in and return the existing $messages array through the method every time I want to add a new message. I even tried using a session var for this, but that is obviously not suited for this purpose at all (it will always be 1 pageload too late). Any suggestions? Thanks!

    Read the article

  • JQUERY - how Two elements - IMG - DIV when hover over IMG show/hide the DIV - added with hover hide/

    - by Jan Fosgerau
    Im very new to the wonder that is jquery. and i just figure out how to make my img buttons show/hide with a opacity difference (as such) <script type="text/javascript"> <![CDATA[ $(".ExcommKnap").mouseover(function () { $(this).stop().fadeTo('fast', 0.5, function(){}) }); $(".ExcommKnap").mouseout(function () { $(this).stop().fadeTo('fast', 1.0, function(){}) }); ]]> </script> which is good and all. but i also need to make the button when hovered over show text just above it that is specific to that button. i made these here elements that are looped in a for each. <div style="top:10px; width:755px;text-align:right; position:absolute; "> <div id="Page-{@id}" class="headlinebox"> <xsl:value-of select="@nodeName"/> </div> </div> <a href="{umbraco.library:NiceUrl(@id)}"> <img class="ExcommKnap" src="{$media/data[@alias='umbracoFile']}" /> </a> i need to make the individual text appear when hovered over its button. hence i have the id="page-{@id}" looped out along and need to get this place in the jquery code i presume. so when i hover over a img class="ExcommKnap" it makes the correct text visible. But i need the div id="page-{id}" to be invisible to begin with on pageload and then visible when its button is being hovered over. can anyone help ?

    Read the article

  • how Two elements - IMG - DIV when hover over IMG show/hide the DIV - added with hover hide/show on i

    - by Jan Fosgerau
    Im very new to the wonder that is jquery. and i just figure out how to make my img buttons show/hide with a opacity difference (as such) <script type="text/javascript"> <![CDATA[ $(".ExcommKnap").mouseover(function () { $(this).stop().fadeTo('fast', 0.5, function(){}) }); $(".ExcommKnap").mouseout(function () { $(this).stop().fadeTo('fast', 1.0, function(){}) }); ]]> </script> which is good and all. but i also need to make the button when hovered over show text just above it that is specific to that button. i made these here elements that are looped in a for each. <div style="top:10px; width:755px;text-align:right; position:absolute; "> <div id="Page-{@id}" class="headlinebox"> <xsl:value-of select="@nodeName"/> </div> </div> <a href="{umbraco.library:NiceUrl(@id)}"> <img class="ExcommKnap" src="{$media/data[@alias='umbracoFile']}" /> </a> i need to make the individual text appear when hovered over its button. hence i have the id="page-{@id}" looped out along and need to get this place in the jquery code i presume. so when i hover over a img class="ExcommKnap" it makes the correct text visible. But i need the div id="page-{id}" to be invisible to begin with on pageload and then visible when its button is being hovered over. can anyone help ?

    Read the article

  • JavaScript Intellisense with Telerik in ASP.NET Master Page Project with VS 2010

    - by Otto Neff
    Today I was looking for a solution to get finally the JScript/Javascript/jQuery Intellisense Featureworking with my ASP.Net Webform Project to work. I found some good articles: - JScript IntelliSense Overview- JScript IntelliSense: A Reference for the “Reference” Tag- Enabling JavaScript intellisense in VS.NET 2010 to work with SharePoint 2010- Rich IntelliSense for jQueryBUT, all of suggested solutions did not work right with my Master Page based Visual Studio 2010 Solution.Only with physical Javascript Files (Telerik includes certain Javascript Files like jQuery as Ressource) or/andconfigure always a new ASP.NET Scriptmanager / RadScriptManager on every page derived from the Master Page, wasn't exactly what I was looking for. So I came up with the following simple Solution, to Trick VS2010and still have the Project running with multiple runat="server" Scriptmanagers. In short:- New ASP.NET control derived from ScriptManager with emtpy overwritten OnInit() to use it as emtpy wrapper for VS2010. In detail:New RadScriptManager Classusing System; using System.Collections.Generic; using System.Linq; using System.Web; using Telerik.Web.UI; namespace IntellisenseJavascript.Controls { public class IntelliJS : RadScriptManager { protected override void OnInit(EventArgs e) { } protected override void OnPreRender(EventArgs e) { } protected override void OnLoad(EventArgs e) { } protected override void Render(System.Web.UI.HtmlTextWriter writer) { } public override void RenderControl(System.Web.UI.HtmlTextWriter writer) { } } } web.config<configuration> ... <system.web> ... <pages> <controls> <add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI, Version=2011.3.1115.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4"/> <add tagPrefix="VSFix" namespace="IntellisenseJavascript.Controls" assembly="IntellisenseJavascript"/> </controls> </pages> ... Master Page<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="IntellisenseJavascript.Site" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html > <head id="head" runat="server"> <title></title> <telerik:RadStyleSheetManager ID="radStyleSheetManager" runat="server" /> </head> <body> <form id="form" runat="server"> <telerik:RadScriptManager ID="radScriptManager" runat="server"> <Scripts> <asp:ScriptReference Assembly="Telerik.Web.UI, Version=2011.3.1115.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Name="Telerik.Web.UI.Common.Core.js" /> <asp:ScriptReference Assembly="Telerik.Web.UI, Version=2011.3.1115.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Name="Telerik.Web.UI.Common.jQuery.js" /> <asp:ScriptReference Assembly="Telerik.Web.UI, Version=2011.3.1115.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Name="Telerik.Web.UI.Common.jQueryInclude.js" /> </Scripts> </telerik:RadScriptManager> <telerik:RadAjaxManager ID="radAjaxManager" runat="server"> </telerik:RadAjaxManager> <div> #MASTER CONTENT# <asp:ContentPlaceHolder ID="contentPlaceHolder" runat="server"> </asp:ContentPlaceHolder> </div> </form> <script type="text/javascript"> $(function () { // Masterpage ready $('body').css('margin', '50px'); }); </script> </body> </html> ASPX Page<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="IntellisenseJavascript.Default" %> <asp:Content ID="Content1" ContentPlaceHolderID="contentPlaceHolder" runat="server"> <VSFix:IntelliJS runat="server" ID="intelliJS"> <Scripts> <asp:ScriptReference Assembly="Telerik.Web.UI, Version=2011.3.1115.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Name="Telerik.Web.UI.Common.Core.js" /> <asp:ScriptReference Assembly="Telerik.Web.UI, Version=2011.3.1115.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Name="Telerik.Web.UI.Common.jQuery.js" /> <asp:ScriptReference Assembly="Telerik.Web.UI, Version=2011.3.1115.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Name="Telerik.Web.UI.Common.jQueryInclude.js" /> </Scripts> </VSFix:IntelliJS> <div style="border: 5px solid #FF9900;"> #PAGE CONTENT# </div> <script type="text/javascript"> $(function () { // Page ready $('body').css('border', '5px solid #888'); }); </script> </asp:Content> The Result I know, this is not the way it meant to be... but now at least you can have a Main ScriptManager for all Common Scripts and Settings, inject page specific Javascripts in PageLoad Event in normal ASPX Files and have JavaScript Intellisense for defined Scripts from JS Files or Assembly Ressouce in your Content Maybe, vNext will fix this.

    Read the article

  • jquery checkbox help

    - by sea_1987
    The Problem I am trying to run some ajax on one my pages for my website, basically I have three checkboxes all of which on pageload are unselected, when a checkbox is clicked I need to be able load in via ajax the relevant HTML. This system is currently a PHP script that depending on what the POST is set returns a different view, so I think all I need to is send the POST via AJAX, but I need to do everytime a new checkbox is checked. My HTML looks like this, div class="segment"> <div class="label"> <label>Choose region: </label> </div> <div class="column w190"> <div class="segment"> <div class="input"> <input type="checkbox" checked="checked" class="radio checked" value="Y" name="area[Nationwide]" id="inp_Nationwide"> </div> <div class="label "> <label for="inp_Nationwide">Nationwide</label> </div> <div class="s">&nbsp;</div> </div> </div> <div class="column w190"> <div class="segment"> <div class="input"> <input type="checkbox" checked="checked" class="radio checked" value="Y" name="area[Lancashire]" id="inp_Lancashire"> </div> <div class="label "> <label for="inp_Lancashire">Lancashire</label> </div> <div class="s">&nbsp;</div> </div> </div> <div class="column w190"> <div class="segment"> <div class="input"> <input type="checkbox" checked="checked" class="radio" value="Y" name="area[West_Yorkshire]" id="inp_West_Yorkshire"> </div> <div class="label "> <label for="inp_West_Yorkshire">West Yorkshire</label> </div> <div class="s">&nbsp;</div> </div> <div class="s">&nbsp;</div> </div> </div> My current attempt was to ascertain whether the input has been clicked so I have done this with my javascript, though this is probably wrong, $('input.radio').click(function(){ if($(this).hasClass('clicked')) { $(this).removeClass('clicked'); } else { $(this).addClass('clicked'); } });

    Read the article

  • Error in facebook.dll facebooksdk

    - by Surendar Radhakrishnan
    I got the web application working with facebooksdk and when i deployed it...it is running fine for sometime and it is throwing the error like this... Server Error in '/' Application. Could not load file or assembly 'Facebook, Version=4.1.1.0, Culture=neutral, PublicKeyToken=58cb4f2111d1e6de' or one of its dependencies. Access is denied. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IO.FileLoadException: Could not load file or assembly 'Facebook, Version=4.1.1.0, Culture=neutral, PublicKeyToken=58cb4f2111d1e6de' or one of its dependencies. Access is denied. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Assembly Load Trace: The following information can be helpful to determine why the assembly 'Facebook, Version=4.1.1.0, Culture=neutral, PublicKeyToken=58cb4f2111d1e6de' could not be loaded. WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. Stack Trace: [FileLoadException: Could not load file or assembly 'Facebook, Version=4.1.1.0, Culture=neutral, PublicKeyToken=58cb4f2111d1e6de' or one of its dependencies. Access is denied.] Secured_Login.FacebookVerification() +0 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25 System.Web.UI.Control.LoadRecursive() +71 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3048 Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1 i got this method in pageload protected void Page_Load(object sender, EventArgs e) { FacebookVerification(); } protected void FacebookVerification() { try { FacebookApp fbApp = new FacebookApp(); if (fbApp.Session != null) { dynamic myinfo = fbApp.Get("me"); String firstname = myinfo.first_name; String lastname = myinfo.last_name; lblFBStatus.Text = "you signed in as " + firstname + " " + lastname ; } else { lblFBStatus.Text = "Please sign in with facebook"; } } catch (Exception) { throw; } }

    Read the article

  • disable dates using jquery inside gridview control

    - by bladerunner
    Hi there, I have a gridview which contains a textbox control. I need to show the calendar for the user to pick the date and certain dates are to be disabled using jquery. I found a post on stackoverflow that talked about how to disable certain dates. I am done with that part, except not sure how to pass the textbox control to this jquery function. Here is the code. <script type="text/javascript" language="javascript"> function pageLoad(sender, args) { var enabledDays = ['09/21/2011', '10/05/2011', '10/19/2011', '11/02/2011', '11/16/2011']; /* utility functions */ function editDays(date) { for (var i = 0; i < enabledDays.length; i++) { if (new Date(enabledDays[i]).toString() == date.toString()) { return [true]; } } return [false]; } /* create datepicker */ $(document).ready(function() { $('#<%= txtInHomeDate.ClientID %>').datepicker({ beforeShow: springDate, beforeShowDay: editDays, dateFormat: 'mm/dd/yy', buttonImage: 'images/cal.gif', buttonText: 'Choose date', firstDay: 1, buttonImageOnly: true, showOn: 'both', showAnim: 'fadeIn', onSelect: function() { $(this).trigger("onchange", null); } }); function springDate() { var defaultMin = new Date(); var defaultMax = new Date(); var Min = defaultMin; var Max = defaultMax; // make valid date from hiddenfied value format is MM/dd/yyyy dateMin = $('#<%= hfStDate.ClientID %>').val(); dateMin = new Date(dateMin); dateMax = $('#<%= hfEndDate.ClientID %>').val(); dateMax = new Date(dateMax); if (dateMin && dateMax) { Min = new Date(dateMin.getFullYear(), dateMin.getMonth(), dateMin.getDate()); Max = new Date(dateMax.getFullYear(), dateMax.getMonth(), dateMax.getDate()); } return { minDate: Min, maxDate: Max }; } }); } <.... <asp:TemplateField HeaderText="In-Home Date"> <ItemStyle HorizontalAlign="Center" /> <ItemTemplate> <asp:HiddenField ID="hfStDate" runat="server" Value="09/01/2011" /> <asp:HiddenField ID="hfEndDate" runat="server" Value="11/30/2011" /> <asp:TextBox ID="txtInHomeDate" runat="server" /> </ItemTemplate> </asp:TemplateField> Currently, it errors out since the jquery function won't find the txtInHomeDate. Could I get some help as I am pretty close to get this done? Thanks!!

    Read the article

  • What is wrong with these jquery statements?

    - by Pandiya Chendur
    I cant able to get this jquery statement to work on page load but it works once when i refresh F5 the page..... <script type="text/javascript"> var itemsPerPage = 5; $(document).ready(function() { getRecordspage(0, itemsPerPage); var maxvalues = $("#HfId").val(); alert(maxvalues); $(".pager").pagination(maxvalues, { //my syntax }); }); </script> On the initial pageload alert(maxvalues); is nothing... But when i refresh it shows the value of maxvalues which is in the hidden field HfId because it is assigned in the function getRecordspage.... Why this strange behaviour.... Any suggestion... EDIT: function getRecordspage(curPage) { $.ajax({ type: "POST", url: "Default.aspx/GetRecords", data: "{'currentPage':" + (curPage + 1) + ",'pagesize':5}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(jsonObj) { $("#ResultsDiv").empty(); $("#HfId").val(""); var strarr = jsonObj.d.split('##'); var jsob = jQuery.parseJSON(strarr[0]); var divs = ''; $.each(jsob.Table, function(i, employee) { divs += '<div class="resultsdiv"><br /><span class="resultName">' + employee.Emp_Name + '</span><span class="resultfields" style="padding-left:100px;">Category&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.Desig_Name + '</span><br /><br /><span id="SalaryBasis" class="resultfields">Salary Basis&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.SalaryBasis + '</span><span class="resultfields" style="padding-left:25px;">Salary&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.FixedSalary + '</span><span style="font-size:110%;font-weight:bolder;padding-left:25px;">Address&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.Address + '</span></div>'; }); $("#ResultsDiv").append(divs); $(".resultsdiv:even").addClass("resultseven"); $(".resultsdiv").hover(function() { $(this).addClass("resultshover"); }, function() { $(this).removeClass("resultshover"); }); $("#HfId").val(strarr[1]); } }); }

    Read the article

  • Animate css attributes: set "bottom" and remove "top"

    - by Slevin
    I'm working on a few animations with jQuery. I have 3-4 elements which should slide in from the top. I defined their positions with css: #element-1 { top:124px; left:0px; right:auto; bottom:auto; } #element-2 { top:230px; left:670px; right:auto; bottom:auto; } #element-3 { top:auto; left:0px; right:auto; bottom:100px; } Then I save their positions initial on pageload, cause i have to manipulate the css value to top: -1000px to hide them and make the "slide in from top" animation possible. var image_margins = []; $('img').each(function() { var obj = $(this), id = obj.attr('id'), mtop = obj.css('top'), mleft = obj.css('left'), mright = obj.css('right'), mbottom = obj.css('bottom'); // save alle margins in array image_margins[id] = {mtop:mtop,mleft:mleft,mright:mright,mbottom:mbottom}; // hide all content elements obj.css({'top':'-1000px'}); }); When the user clicks the animate button, the elements should slide to their saved positions. The problem: i can't remove the top attribute. Some elements only have bottom margins. I tried to set top to auto or '', but it's always 0px in DOM inspector. And bottom don't work if top is set. How can i get rid of the top attribute? $('.button').click(function(){ $('img').each(function() { var image = $(this), id = image.attr('id'), timeout = 0; setTimeout(function() { var mtop, mleft, mright, mbottom; if (image_margins[id].mtop != 'auto') { mtop = image_margins[id].mtop; } else { mtop = ''; } if (image_margins[id].mleft != 'auto') { mleft = image_margins[id].mleft; } else { mleft = ''; } if (image_margins[id].mright != 'auto') { mright = image_margins[id].mright; } else { mright = ''; } if (image_margins[id].mbottom != 'auto') { mbottom = image_margins[id].mbottom; } else { mbottom = ''; } image.animate({'top':mtop,'left':mleft,'right':mright,'bottom':mbottom},500); },timeout); timeout = timeout + 200; }); });

    Read the article

  • BES Express - failed to run Administration Service

    - by Max Gontar
    Hi! I have installed BES Express on Windows Server 7 with Exchange 2007 following by RIM tutorial JDK 1.6.18, JDK\bin included into Path variable After reboot I've run Blackberry Administration Service and receive such error in browser window: HTTP Status 500 - -------------------------------------------------------------------------------- type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception javax.servlet.ServletException: org.apache.hivemind.ApplicationRuntimeException: Missing classpath resource '/com/rim/bes/bas/web/adminconsole/pages/login/SystemError.page'. [context:/WEB-INF/webAdminConsole.application, line 25, column 37] org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service(WebRequestServicerPipelineBridge.java:60) $ServletRequestServicer_12d51b7c397.service($ServletRequestServicer_12d51b7c397.java) org.apache.tapestry.request.DecodedRequestInjector.service(DecodedRequestInjector.java:55) $ServletRequestServicerFilter_12d51b7c393.service($ServletRequestServicerFilter_12d51b7c393.java) $ServletRequestServicer_12d51b7c399.service($ServletRequestServicer_12d51b7c399.java) org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecoderFilter.java:52) $ServletRequestServicerFilter_12d51b7c391.service($ServletRequestServicerFilter_12d51b7c391.java) $ServletRequestServicer_12d51b7c399.service($ServletRequestServicer_12d51b7c399.java) org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestEncoding.java:53) $ServletRequestServicerFilter_12d51b7c395.service($ServletRequestServicerFilter_12d51b7c395.java) $ServletRequestServicer_12d51b7c399.service($ServletRequestServicer_12d51b7c399.java) $ServletRequestServicer_12d51b7c305.service($ServletRequestServicer_12d51b7c305.java) org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:123) com.rim.bes.bas.web.common.BASApplicationServlet.doService(BASApplicationServlet.java:153) org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:79) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) com.rim.bes.bas.web.console.LoginDispatcher.processRequest(LoginDispatcher.java:146) com.rim.bes.bas.web.console.LoginDispatcher.doGet(LoginDispatcher.java:79) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) com.rim.bes.bas.web.common.ResponseHeadersFilter.doFilter(ResponseHeadersFilter.java:85) com.rim.bes.bas.web.console.VSJSupportFilter.doFilter(VSJSupportFilter.java:228) org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) root cause org.apache.hivemind.ApplicationRuntimeException: Missing classpath resource '/com/rim/bes/bas/web/adminconsole/pages/login/SystemError.page'. [context:/WEB-INF/webAdminConsole.application, line 25, column 37] org.apache.tapestry.error.ExceptionPresenterImpl.presentException(ExceptionPresenterImpl.java:64) com.rim.bes.bas.web.common.CommonExceptionPresenter.presentException(CommonExceptionPresenter.java:269) com.rim.bes.bas.web.common.CommonExceptionPresenter.presentException(CommonExceptionPresenter.java:113) $ExceptionPresenter_12d51b7c2cf.presentException($ExceptionPresenter_12d51b7c2cf.java) org.apache.tapestry.engine.AbstractEngine.activateExceptionPage(AbstractEngine.java:121) org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:280) org.apache.tapestry.services.impl.InvokeEngineTerminator.service(InvokeEngineTerminator.java:60) $WebRequestServicer_12d51b7c3b5.service($WebRequestServicer_12d51b7c3b5.java) com.rim.bes.bas.web.console.ObjectCacheServiceFilter.service(ObjectCacheServiceFilter.java:72) $WebRequestServicerFilter_12d51b7c3b9.service($WebRequestServicerFilter_12d51b7c3b9.java) $WebRequestServicer_12d51b7c3bb.service($WebRequestServicer_12d51b7c3bb.java) com.rim.bes.bas.web.common.ServiceFilter.service(ServiceFilter.java:84) $WebRequestServicerFilter_12d51b7c3b7.service($WebRequestServicerFilter_12d51b7c3b7.java) $WebRequestServicer_12d51b7c3bb.service($WebRequestServicer_12d51b7c3bb.java) $WebRequestServicer_12d51b7c3b1.service($WebRequestServicer_12d51b7c3b1.java) org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service(WebRequestServicerPipelineBridge.java:56) $ServletRequestServicer_12d51b7c397.service($ServletRequestServicer_12d51b7c397.java) org.apache.tapestry.request.DecodedRequestInjector.service(DecodedRequestInjector.java:55) $ServletRequestServicerFilter_12d51b7c393.service($ServletRequestServicerFilter_12d51b7c393.java) $ServletRequestServicer_12d51b7c399.service($ServletRequestServicer_12d51b7c399.java) org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecoderFilter.java:52) $ServletRequestServicerFilter_12d51b7c391.service($ServletRequestServicerFilter_12d51b7c391.java) $ServletRequestServicer_12d51b7c399.service($ServletRequestServicer_12d51b7c399.java) org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestEncoding.java:53) $ServletRequestServicerFilter_12d51b7c395.service($ServletRequestServicerFilter_12d51b7c395.java) $ServletRequestServicer_12d51b7c399.service($ServletRequestServicer_12d51b7c399.java) $ServletRequestServicer_12d51b7c305.service($ServletRequestServicer_12d51b7c305.java) org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:123) com.rim.bes.bas.web.common.BASApplicationServlet.doService(BASApplicationServlet.java:153) org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:79) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) com.rim.bes.bas.web.console.LoginDispatcher.processRequest(LoginDispatcher.java:146) com.rim.bes.bas.web.console.LoginDispatcher.doGet(LoginDispatcher.java:79) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) com.rim.bes.bas.web.common.ResponseHeadersFilter.doFilter(ResponseHeadersFilter.java:85) com.rim.bes.bas.web.console.VSJSupportFilter.doFilter(VSJSupportFilter.java:228) org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) root cause org.apache.hivemind.ApplicationRuntimeException: Missing classpath resource '/com/rim/bes/bas/web/adminconsole/pages/login/SystemError.page'. [context:/WEB-INF/webAdminConsole.application, line 25, column 37] org.apache.tapestry.asset.ClasspathAssetFactory.createAbsoluteAsset(ClasspathAssetFactory.java:61) $AssetFactory_12d51b7c400.createAbsoluteAsset($AssetFactory_12d51b7c400.java) org.apache.tapestry.asset.ContextAssetFactory.createAsset(ContextAssetFactory.java:66) $AssetFactory_12d51b7c3fe.createAsset($AssetFactory_12d51b7c3fe.java) $AssetFactory_12d51b7c404.createAsset($AssetFactory_12d51b7c404.java) $AssetFactory_12d51b7c2ff.createAsset($AssetFactory_12d51b7c2ff.java) org.apache.tapestry.asset.AssetSourceImpl.findAsset(AssetSourceImpl.java:64) $AssetSource_12d51b7c3fa.findAsset($AssetSource_12d51b7c3fa.java) org.apache.tapestry.services.impl.NamespaceResourcesImpl.findSpecificationResource(NamespaceResourcesImpl.java:61) org.apache.tapestry.services.impl.NamespaceResourcesImpl.getPageSpecification(NamespaceResourcesImpl.java:71) org.apache.tapestry.engine.Namespace.locatePageSpecification(Namespace.java:264) org.apache.tapestry.engine.Namespace.getPageSpecification(Namespace.java:172) org.apache.tapestry.resolver.PageSpecificationResolverImpl.resolve(PageSpecificationResolverImpl.java:131) $PageSpecificationResolver_12d51b7c3f4.resolve($PageSpecificationResolver_12d51b7c3f4.java) $PageSpecificationResolver_12d51b7c3f5.resolve($PageSpecificationResolver_12d51b7c3f5.java) org.apache.tapestry.pageload.PageSource.getPage(PageSource.java:115) $IPageSource_12d51b7c2e5.getPage($IPageSource_12d51b7c2e5.java) org.apache.tapestry.engine.RequestCycle.loadPage(RequestCycle.java:268) org.apache.tapestry.engine.RequestCycle.getPage(RequestCycle.java:251) org.apache.tapestry.error.ExceptionPresenterImpl.presentException(ExceptionPresenterImpl.java:40) com.rim.bes.bas.web.common.CommonExceptionPresenter.presentException(CommonExceptionPresenter.java:269) com.rim.bes.bas.web.common.CommonExceptionPresenter.presentException(CommonExceptionPresenter.java:113) $ExceptionPresenter_12d51b7c2cf.presentException($ExceptionPresenter_12d51b7c2cf.java) org.apache.tapestry.engine.AbstractEngine.activateExceptionPage(AbstractEngine.java:121) org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:280) org.apache.tapestry.services.impl.InvokeEngineTerminator.service(InvokeEngineTerminator.java:60) $WebRequestServicer_12d51b7c3b5.service($WebRequestServicer_12d51b7c3b5.java) com.rim.bes.bas.web.console.ObjectCacheServiceFilter.service(ObjectCacheServiceFilter.java:72) $WebRequestServicerFilter_12d51b7c3b9.service($WebRequestServicerFilter_12d51b7c3b9.java) $WebRequestServicer_12d51b7c3bb.service($WebRequestServicer_12d51b7c3bb.java) com.rim.bes.bas.web.common.ServiceFilter.service(ServiceFilter.java:84) $WebRequestServicerFilter_12d51b7c3b7.service($WebRequestServicerFilter_12d51b7c3b7.java) $WebRequestServicer_12d51b7c3bb.service($WebRequestServicer_12d51b7c3bb.java) $WebRequestServicer_12d51b7c3b1.service($WebRequestServicer_12d51b7c3b1.java) org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service(WebRequestServicerPipelineBridge.java:56) $ServletRequestServicer_12d51b7c397.service($ServletRequestServicer_12d51b7c397.java) org.apache.tapestry.request.DecodedRequestInjector.service(DecodedRequestInjector.java:55) $ServletRequestServicerFilter_12d51b7c393.service($ServletRequestServicerFilter_12d51b7c393.java) $ServletRequestServicer_12d51b7c399.service($ServletRequestServicer_12d51b7c399.java) org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecoderFilter.java:52) $ServletRequestServicerFilter_12d51b7c391.service($ServletRequestServicerFilter_12d51b7c391.java) $ServletRequestServicer_12d51b7c399.service($ServletRequestServicer_12d51b7c399.java) org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestEncoding.java:53) $ServletRequestServicerFilter_12d51b7c395.service($ServletRequestServicerFilter_12d51b7c395.java) $ServletRequestServicer_12d51b7c399.service($ServletRequestServicer_12d51b7c399.java) $ServletRequestServicer_12d51b7c305.service($ServletRequestServicer_12d51b7c305.java) org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:123) com.rim.bes.bas.web.common.BASApplicationServlet.doService(BASApplicationServlet.java:153) org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:79) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) com.rim.bes.bas.web.console.LoginDispatcher.processRequest(LoginDispatcher.java:146) com.rim.bes.bas.web.console.LoginDispatcher.doGet(LoginDispatcher.java:79) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) com.rim.bes.bas.web.common.ResponseHeadersFilter.doFilter(ResponseHeadersFilter.java:85) com.rim.bes.bas.web.console.VSJSupportFilter.doFilter(VSJSupportFilter.java:228) org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) Can you help me? Thank you! same question on bbforums

    Read the article

  • Run javascript after form submission in update panel?

    - by AverageJoe719
    This is driving me crazy! I have read at least 5 questions on here closely related to my problem, and probably 5 or so more pages just from googling. I just don't get it. I am trying to have a jqueryui dialog come up after a user fills out a form saying 'registration submitted' and then redirecting to another page, but I cannot for the life of me get any javascript to work, not even a single alert. Here is my update panel: <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="upForm" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="False"> <ContentTemplate> 'Rest of form' <asp:Button ID="btnSubmit" runat="server" Text="Submit" /> <p>Did register Pass? <%= registrationComplete %></p> </ContentTemplate> </asp:UpdatePanel> The Jquery I want to execute: (Right now this is sitting in the head of the markup, with autoOpen set to false) <script type="text/javascript"> function pageLoad() { $('#registerComplete').dialog({ autoOpen: true, width: 270, resizable: false, modal: true, draggable: false, buttons: { "Ok": function() { window.location.href = "someUrl"; } } }); } </script> Finally my code behind: ( Commented out all the things I've tried) Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSubmit.Click 'Dim sbScript As New StringBuilder()' registrationComplete = True registrationUpdatePanel.Update() 'sbScript.Append("<script language='JavaScript' type='text/javascript'>" + ControlChars.Lf)' 'sbScript.Append("<!--" + ControlChars.Lf)' 'sbScript.Append("window.location.reload()" + ControlChars.Lf)' 'sbScript.Append("// -->" + ControlChars.Lf)' 'sbScript.Append("</")' 'sbScript.Append("script>" + ControlChars.Lf)' 'ScriptManager.RegisterClientScriptBlock(Me.Page, Me.GetType(), "AutoPostBack", sbScript.ToString(), False)' 'ClientScript.RegisterStartupScript("AutoPostBackScript", sbScript.ToString())' 'Response.Write("<script type='text/javascript'>alert('Test')</script>")' 'Response.Write("<script>windows.location.reload()</script>")' End Sub I've tried: Passing variables from server to client via inline <%= % in the javascript block of the head tag. Putting that same code in a script tag inside the updatePanel. Tried to use RegisterClientScriptBlock and RegisterStartUpScript Just doing a Response.Write with the script tag written in it. Tried various combinations of putting the entire jquery.dialog code in the registerstartup script, or just trying to change the autoOpen property, or just calling "open" on it. I can't even get a simple alert to work with any of these, so I am doing something wrong but I just don't know what it is. Here is what I know: The Jquery is binding properly even on async postbacks, because the div container that is the dialog box is always invisible, I saw a similiar post on here stating that was causing an issue, this isn't the case here. Using page_load instead of document.ready since that is supposed to run on both async and normal postbacks, so that isn't the issue. The update panel is updating correctly because <p>Did register Pass? <%= registrationComplete %></p> updates to true after I submit the form. So how can I make this work? All I want is - click submit button inside an update panel - run server side code to validate form and insert into db - if everything succeeded, have that jquery (modal) dialog pop up saying hey it worked.

    Read the article

  • jQuery dialog box, php form.

    - by tony noriega
    i have a dialog box that opens on pageload for a site. script type="text/javascript"> $(function() { $('#dialog-message').dialog({ modal: 'true', width: '400' }); }); </script> this pulls up an include: <div id="dialog-message" title="Free Jiu Jitsu Session at Alliance"> <!--#include virtual="/includes/guest.php" --> guest.php has a very small form that is processed by the page itself: <?php $dbh=mysql_connect //login stuff here if (isset($_POST['submit'])) { if (!$_POST['name'] | !$_POST['email']) { echo"<div class='error'>Error<br />Please provide your Name and Email Address so we may properly contact you.</div>"; } else { $age = $_POST['age']; $name = $_POST['name']; $gender = $_POST['gender']; $email = $_POST['email']; $phone = $_POST['phone']; $comments = $_POST['comments']; $query = "INSERT INTO table here (age,name,gender,email,phone,comments) VALUES ('$age','$name','$gender','$email','$phone','$comments')"; mysql_query($query); mysql_close(); $yoursite = "my site here"; $youremail = $email; $subject = "Website Guest Contact Us Form"; $message = "message here"; $email2 = "send to email address"; mail($email2, $subject, $message, "From: $email"); echo"<div class='thankyou'>Thank you for contacting us,<br /> we will respond as soon as we can.</div>"; } } ?> <form id="contact_us" class="guest" method="post" action="/guest.php" > <fieldset> <legend>Personal Info</legend> <label for="name" class="guest">Name:</label> <input type="text" name="name" id="name" value="" /><br> <label for="phone" class="guest">Phone:</label> <input type="text" name="phone" id="phone" value="" /><br> <label for="email" class="guest">Email Address:</label> <input type="text" name="email" id="email" value="" /><br> <label for="age" class="guest">Age:</label> <input type="text" name="age" id="age" value="" size="2" /><br> <label for="gender" class="guest">Sex:</label> <input type="radio" name="gender" value="male" /> Male <input type="radio" name="gender" value="female" /> Female<br /> </fieldset> <fieldset> <legend>Comments</legend> <label for="comments" class="guest">Comments / Questions:</label> <textarea id="comments" name="comments" rows="4" cols="22"></textarea><br> <input type="submit" value="Submit" name="submit" /> <input type="Reset" value="Reset" /> </fieldset> </form> Problem is, that the path of the form action does not work, becasue this dialog box is on the index.html page of the site, and if i put the absolute path, it doesnt process... i have this functioning on another contact us page, so i know it works, but wit the dialog box, it seems to have stumped me... what should i do?

    Read the article

  • LinkButtons Created Dynamically in a Repeater Don't Fire ItemCommand Event

    - by 5arx
    Hi. I've got a repeater that's used to display the output of a dynamic report that takes criteria from webcontrols on the page. Within the repeater's ItemDataBound method I'm adding controls (Linkbuttons for sorting by column values) dynamically to the header of the repeater based on values selected in a checkbox list and at this point setting the CommandArgument and CommandName properties of the linkbuttons. The issue is that when the linkbuttons are clicked they don't fire the ItemCommand event although they are clearly being correctly created and added to the header (there is some additional code to set the cssClass, text etc. and this works as expected.) The first column header in the repeater is set in the markup and the itemcommand event fires correctly on this one only. When the other column headers are clicked the repeater rebinds as programmed, but the columns are not dynamically re-generated. I would really appreciate somebody explaining what I'm doing wrong - afaik I'm following the approved way of doing this :-( Simplified code follows: Nightmare.ascx <asp:repeater runat="server" id="rptReport" OnItemDataBound="rptResults_ItemDataBound" OnItemCommand="rptResults_ItemCommand" EnableViewState="true"> <headertemplate> <table> <tr runat="Server" id="TRDynamicHeader"> <th> <!-- This one works --> <asp:Linkbutton runat="server" CommandName="sort" commandArgument='<%# Eval("Name")%?' /> </th> <!-- additional header cells get added dynamically here --> </tr> </headertemplate> <itemTemplate> <td><%# Eval("Name")</td> ... </itemTemplate> </asp:repeater> Nightmare.ascx.cs protected void PageLoad(object sender, eventArgs e){ if (! isPostback){ setupGui();//just binds dropdowns etc. to datasources } } protected void btnRunReport_Click(...){ List<ReportLines> lstRep = GetReportLines(); rptReport.DataSource = lstRep; repReport.DataBind(); } protected void rptReport_ItemDataBound (...){ if (e.Item.ItemType == ListItemType.Header) { foreach (ListItem li in chbxListBusFuncs.Items) { if (li.Selected) { th = new HtmlTableCell(); lb = new LinkButton(); lb.CssClass = "SortColHeader"; lb.CommandArgument = li.Text.Replace(" ", ""); lb.CommandName = "sort"; lb.Text = li.Text; th.Controls.Add(lb); ((HtmlTableRow)e.Item.FindControl("TRDynamicHeader")).Cells.Add(th); } } } if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { //Row level customisations, totals calculations etc. } } <!-- this only gets called when the 'hardcoded' linkbutton in the markup is clicked. protected void rptReport_ItemCommand(object sender, Eventargs e){ lblDebug.Text = string.Format("Well? What's Happening? -> {0}:{1}", e.CommandName, e.CommandArgument.ToString()); } (The only thing that can call the runreport routine is a single button on the page, not shown in the code snippet above.)

    Read the article

  • Can overlay work with a portion of a page that has codebehind functionallity?

    - by rolando
    i have a complete DIV in wich a have a gridview and a multiview with codebehind action: <cc3:CRDataSource EnableViewState="true" ID="DsOpciones" runat="server" SQLSelect="CartelElectronico,OpcionSeleccion_Todos"> <Parameters> <asp:QueryStringParameter Name="@FactorEvaluacionId" QueryStringField="FactorEvaluacionId" Type="String" /> </Parameters> </cc3:CRDataSource> <cc3:CRGridView ID="gvTipoFactorSeleccion" runat="server" DataKeyNames="OpcionSeleccionID" AllowPaging="false" AllowSorting="False" AutoGenerateColumns="False" Titulo="Opciones de Factor de Evaluacion" NoRowsMsg="No se encontraron Opciones para el factor de evaluación" CssClass="Table" AllowExport="False" AllowFilter="False" AllowCollapse="True" EnableViewState="False" PageSize="1000000000" DataSourceID="DsOpciones" OnRowUpdating="gvTipoFactorSeleccion_RowUpdating" OnRowDeleting="gvTipoFactorSeleccion_RowDeleting"> <Columns> <asp:BoundField DataField="Nombre" HeaderText="Nombre" SortExpression="Nombre" ItemStyle-HorizontalAlign="Left" /> <asp:BoundField DataField="Puntos" HeaderText="Puntos" ItemStyle-HorizontalAlign="Center" /> <asp:CommandField ButtonType="Link" ShowDeleteButton="true" DeleteText="Eliminar" ShowEditButton="true" EditText="Modificar" UpdateText="Actualizar" CancelText="Cancelar" /> <asp:TemplateField Visible="false"> <ItemTemplate> </ItemTemplate> </asp:TemplateField> </Columns> </cc3:CRGridView> <br /> <table> <tr valign="baseline"> <td class="contratacionTablaSubrayadoTitulosLineas"> <label class="contratacionEtiquetas"> Opción&nbsp;(*) :</label> </td> <td class="contratacionTablaSubrayadoContenidoLineas"> <asp:TextBox ID="tbOpcion" runat="server" ToolTip="Nombre del Factor de la metodología de evaluación" TabIndex="1" MaxLength="100"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator13" runat="server" ControlToValidate="tbOpcion" ErrorMessage="&nbsp;Debe digitar un nombre para la Opción" Display="Dynamic" CssClass="inlineError" ValidationGroup="InsertarTipoFactorSeleccion" SetFocusOnError="false"></asp:RequiredFieldValidator> </td> </tr> <tr valign="baseline"> <td colspan="2" align="right"> <asp:LinkButton ID="LinkButton1" runat="server" CssClass="contratacionVinculos" ValidationGroup="InsertarTipoFactorSeleccion" OnClick="lbInsertarTipoFactorSeleccion_Click">Insertar</asp:LinkButton>&nbsp;|&nbsp; <asp:LinkButton ID="LinkButton2" runat="server" OnClick="lbCancelarInsertarTipoFactorSeleccion_Click" CssClass="contratacionVinculos" CausesValidation="false">Cancelar</asp:LinkButton> .... Thats just a portion of the div, my question is How can I show that DIV in a jquery overlay without loosing its functionallity? i'm asking because i manage to get it working but when i do a "that-div-postback" the screen loses the DIV and keeps only the background of the overlay. a couple more information: <button class="modalInput button" rel="#prompt"> Buscar</button> <script type="text/javascript"> function pageLoad() { var triggers = $("button.modalInput").overlay({ // some expose tweaks suitable for modal dialogs expose: { color: '#333', loadSpeed: 200, opacity: 0.3, zIndex: 99 }, top: '25%', closeOnClick: true }); } </script> Thanks in advance ;)

    Read the article

  • How to notify client about updated UpdatePanel content on server side

    - by csh1981
    I have a problem with UpdatePanel.Update() which works initially but then stops. I have tumbled with this problem for some time and some background is needed so please read ahead. I have an ASP.net application in which I have a subpage that display computed information in graphs. Each graph is embedded in an UpdatePanel. The graph is a user control that uses the standard asp:Chart for display. My task is to enable this page with AJAX capabilities so the page is responsive during postbacks. When I access this page from another page, during the initial page rendering, I use a wait dialog for each graph and a pageload event on the client side. In the client event, a hidden button is clicked which a server event handles (the hidden button is inside an UpdatePanel so the postback is asynchronous). Each graph is computed and the UpdatePanels are in turn updated with the Chart content. This is done using UpdatePanel.Update. And it is successful. However, I also have some RadioButtons on the page. These are dynamically created. The purpose of them is to switch graph type --- to show the same data in a different way. Same type of time consuming computation is needed in order to do so. I subscribe on each RadioButton's OnCheckedChanged event and the postback is asynchronous since the radiobuttons are inside an UpdatePanel. In the server event handler I determine the type of graph and use this as an input to the Chart control. I then remove the old Chart control from my Panel and adds new Chart and then I call UpdatePanel.Update(). But with no success. Nothing happens, no errors, nothing. Why is this?? I think this is strange because if I compute every Chart data in the initial rendering instead of using the "Wait dialog"-solution described earlier then I can select graph types successfully and all subsequent AJAX requests work as intended. Also, the same code (computing the chart, removal, and adding the Chart control to Panel and UpdatePanel.Update()) is hit during the initial rendering of the page, and it works only the first time. Here is the method that computes the graph and adds it to the panel and update the UpdatePanel: public void UpdateGraph(GraphType type, GraphMapper mapper) { //Panel is the content of UpdatePanelGraph's Panel.Controls.Clear(); chart = new Chart(type, mapper); //Computation happens inside here panel.Controls.Add(chart); //UpdatePanelGraph is in UpdateMode Conditional and has //ChildrenAsTriggers set to false UpdatePanelGraph.Update(); } I really need a way for these radiobuttons to work, possible using some clientside JavaScript or another way of handling things on the server side. I have thought about using a JavaScript postback call on the UpdatePanel instead of the UpdatePanel.Update(). However, the issue I have here is how to notify the client side when the server side is finished with computing the graph? An plausible explanation of the strange behavior is also much appreciated. Any help appreciated, thanks

    Read the article

  • TinyMCE with AJAX (Update Panel) never has a value.

    - by sah302
    I wanted to use a Rich Text Editor for a text area inside an update panel. I found this post: http://www.queness.com/post/212/10-jquery-and-non-jquery-javascript-rich-text-editors via this question: http://stackoverflow.com/questions/1207382/need-asp-net-mvc-rich-text-editor Decided to go with TinyMCE as I used it before in non AJAX situations, and it says in that list it is AJAX compatible. Alright I do the good ol' tinyMCE.init({ //settings here }); Test it out and it disappears after doing a update panel update. I figure out from a question on here that it should be in the page_load function so it gets run even on async postbacks. Alright do that and the panel stays. However, upon trying to submit the value from my textarea, the text of it always comes back as empty because my form validator always says "You must enter a description" even when I enter text into it. This happens the first time the page loads and after async postbacks have been done to the page. Alright I find this http://www.dallasjclark.com/using-tinymce-with-ajax/ and http://stackoverflow.com/questions/699615/cant-post-twice-from-the-same-ajax-tinymce-textarea. I try to add this code into my page load function right after the tinyMCE.init. Doing this breaks all my jquery being called also in the page_load after it, and it still has the same problem. I am still pretty beginner to client side scripting stuff, so maybe I need to put the code in a different spot than page_load? Not sure the posts I linked weren't very clue on where to put that code. My Javascript: <script type="text/javascript"> var redirectUrl = '<%= redirectUrl %>'; function pageLoad() { tinyMCE.init({ mode: "exact", elements: "ctl00_mainContent_tbDescription", theme: "advanced", plugins: "table,advhr,advimage,iespell,insertdatetime,preview,searchreplace,print,contextmenu,paste,fullscreen", theme_advanced_buttons1_add_before: "preview,separator", theme_advanced_buttons1: "bold,italic,underline,separator,justifyleft,justifycenter,justifyright, justifyfull,bullist,numlist,undo,redo,link,unlink,separator,styleselect,formatselect", theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,separator,removeformat,cleanup,charmap,search,replace,separator,iespell,code,fullscreen", theme_advanced_buttons2_add_before: "", theme_advanced_buttons3: "", theme_advanced_toolbar_location: "top", theme_advanced_toolbar_align: "left", extended_valid_elements: "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]", paste_auto_cleanup_on_paste: true, paste_convert_headers_to_strong: true, button_tile_map: true }); tinyMCE.triggerSave(false, true); tiny_mce_editor = tinyMCE.get('ctl00_mainContent_tbDescription'); var newData = tiny_mce_editor.getContent(); tinyMCE.execCommand('mceRemoveControl', false, 'your_textarea_name'); //QJqueryUI dialog stuff }</script> Now my current code doesn't have the tinyMCE.execCommand("mceAddControl",true,'content'); which that one question indicated should also be added. I did try adding it but, again, wasn't sure where to put it and just putting it in the page_load seemed to have no effect. Textbox control: <asp:TextBox ID="tbDescription" runat="server" TextMode="MultiLine" Width="500px" Height="175px"></asp:TextBox><br /> How can I get these values so that the code behind can actually get what is typed in the textarea and my validator won't come up as saying it's empty? Even after async postbacks, since I have multiple buttons on the form that update it prior to actual submission. Thanks! Edit: For further clarification I have form validation on the back-end like so: If tbDescription.Text = "" Or tbDescription.Text Is Nothing Then lblDescriptionError.Text = "You must enter a description." isError = True Else lblDescriptionError.Text = "" End If And this error will always cause the error message to be dispalyed. Edit: Alright I am getting desperate here, I have spent hours on this. I finally found what I thought to be a winner on experts exchange which states the following (there was a part about encoding the value in xml, but I skipped that): For anyone who wants to use tinyMCE with AJAX.Net: Append begin/end handlers to the AJAX Request object. These will remove the tinyMCE control before sending the data (begin), and it will recreate the tinyMCE control (end): Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(function(sender, args) { var edID = "<%=this.ClientID%>_rte_tmce"; // the id of your textbox/textarea. var ed = tinyMCE.getInstanceById(edID); if (ed) { tinyMCE.execCommand('mceFocus', false, edID); tinyMCE.execCommand('mceRemoveControl', false, edID); } }); Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function(sender, args) { var edID = "<%=this.ClientID%>_rte_tmce"; var ed = tinyMCE.getInstanceById(edID); if (ed) { tinyMCE.execCommand('mceAddControl', false, edID); } }); When the user changes/blurs from the tinyMCE control, we want to ensure that the textarea/textbox gets updated properly: ed.onChange.add(function(ed, l) { tinyMCE.triggerSave(true, true); }); Now I have tried this code putting it in its own script tag, putting the begin and end requests into their own script tags and putting the ed.onChange in the page_load, putting everything in the page_load, and putting all 3 in it's own script tag. In all cases it never worked, and even sometimes broke the jquery that is also in my page_load... (and yes I changed the above code to fit my page) Can anyone get this to work or offer a solution?

    Read the article

  • Asp.NET custom templated datalist throws argument out of range (index) on button press

    - by MrTortoise
    I have a class BaseTemplate public abstract class BaseTemplate : ITemplate This adds the controls, and provides abstract methods to implement in the inheriting class. The inheriting class then adds its html according to its data source and manages the data binding. This all works fine - I get the control appearing with properly parsed html. The problem is that the base class adds controls into the template that have their own CommandName arguments; the idea is that the class that implements the custom templated dataList will provide the logic of setting the Selected and Edit Indexes. This class also manages the data binding, etc. It sets all of the templates on the datalist in the Init method (which was another cause of this exception). The exception gets thrown when I hit one of these buttons - I have tried hooking up both their click and command events everywhere in case this was the problem. I have also ensured that their command names do not match any of the system ones. The stack trace does not include any references to my methods or objects which is why I am so stuck. It is the most unhelpful message I can imagine. The really frustrating thing is that I cannot get a breakpoint to fire - i.e. the problem is happening after I click the button, but before and of my code can execute. The last time this exception happened was when I had this code in a user control and was assigning the templates to the datalist in the PageLoad. I moved these into init to fix that problem; however, this is a problem that was there then and I have no idea what is causing it let alone how to solve it (and index out of range doesn't really help without knowing what index.) The Exception Details Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: index The Stack Trace: [ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: index] System.Web.UI.ControlCollection.get_Item(Int32 index) +8665582 System.Web.UI.WebControls.DataList.GetItem(ListItemType itemType, Int32 repeatIndex) +8667655 System.Web.UI.WebControls.DataList.System.Web.UI.WebControls.IRepeatInfoUser.GetItemStyle(ListItemType itemType, Int32 repeatIndex) +11 System.Web.UI.WebControls.RepeatInfo.RenderVerticalRepeater(HtmlTextWriter writer, IRepeatInfoUser user, Style controlStyle, WebControl baseControl) +8640873 System.Web.UI.WebControls.RepeatInfo.RenderRepeater(HtmlTextWriter writer, IRepeatInfoUser user, Style controlStyle, WebControl baseControl) +27 System.Web.UI.WebControls.DataList.RenderContents(HtmlTextWriter writer) +208 System.Web.UI.WebControls.BaseDataList.Render(HtmlTextWriter writer) +30 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19 System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +163 System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32 System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +51 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99 System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19 System.Web.UI.Page.Render(HtmlTextWriter writer) +29 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266 The code Base class: public abstract class BaseTemplate : ITemplate { ListItemType _templateType; public BaseTemplate(ListItemType theTemplateType) { _templateType = theTemplateType; } public ListItemType ListItemType { get { return _templateType; } } #region ITemplate Members public void InstantiateIn(Control container) { PlaceHolder ph = new PlaceHolder(); container.Controls.Add(ph); Literal l = new Literal(); switch (_templateType) { case ListItemType.Header: { ph.Controls.Add(new LiteralControl(@"<table><tr>")); InstantiateInHeader(ph); ph.Controls.Add(new LiteralControl(@"</tr>")); break; } case ListItemType.Footer: { ph.Controls.Add(new LiteralControl(@"<tr>")); InstantiateInFooter(ph); ph.Controls.Add(new LiteralControl(@"</tr></table>")); break; } case ListItemType.Item: { ph.Controls.Add(new LiteralControl(@"<tr>")); InstantiateInItem(ph); ph.Controls.Add(new LiteralControl(@"<td>")); Button select = new Button(); select.ID = "btnSelect"; select.CommandName = "SelectRow"; select.Text = "Select"; ph.Controls.Add(select); ph.Controls.Add(new LiteralControl(@"</td>")); ph.Controls.Add(new LiteralControl(@"</tr>")); ph.DataBinding += new EventHandler(ph_DataBinding); break; } case ListItemType.AlternatingItem: { ph.Controls.Add(new LiteralControl(@"<tr>")); InstantiateInAlternatingItem(ph); ph.Controls.Add(new LiteralControl(@"<td>")); Button select = new Button(); select.ID = "btnSelect"; select.CommandName = "SelectRow"; select.Text = "Select"; ph.Controls.Add(select); ph.Controls.Add(new LiteralControl(@"</td>")); ph.Controls.Add(new LiteralControl(@"</tr>")); ph.DataBinding+=new EventHandler(ph_DataBinding); break; } case ListItemType.SelectedItem: { ph.Controls.Add(new LiteralControl(@"<tr>")); InstantiateInItem(ph); ph.Controls.Add(new LiteralControl(@"<td>")); Button edit = new Button(); edit.ID = "btnEdit"; edit.CommandName = "EditRow"; edit.Text = "Edit"; ph.Controls.Add(edit); Button delete = new Button(); delete.ID = "btnDelete"; delete.CommandName = "DeleteRow"; delete.Text = "Delete"; ph.Controls.Add(delete); ph.Controls.Add(new LiteralControl(@"</td>")); ph.Controls.Add(new LiteralControl(@"</tr>")); ph.DataBinding += new EventHandler(ph_DataBinding); break; } case ListItemType.EditItem: { ph.Controls.Add(new LiteralControl(@"<tr>")); InstantiateInEdit(ph); ph.Controls.Add(new LiteralControl(@"<td>")); Button save = new Button(); save.ID = "btnSave"; save.CommandName = "SaveRow"; save.Text = "Save"; ph.Controls.Add(save); Button cancel = new Button(); cancel.ID = "btnCancel"; cancel.CommandName = "CancelRow"; cancel.Text = "Cancel"; ph.Controls.Add(cancel); ph.Controls.Add(new LiteralControl(@"</td>")); ph.Controls.Add(new LiteralControl(@"</tr>")); ph.DataBinding += new EventHandler(ph_DataBinding); break; } case ListItemType.Separator: { InstantiateInSeperator(ph); break; } } } void ph_DataBinding(object sender, EventArgs e) { DataBindingOverride(sender, e); } /// <summary> /// the controls placed into the PlaceHolder will get wrapped in &lt;table&gt;&lt;tr&gt; &lt;/tr&gt;. I.e. you need to provide the column names wrapped in &lt;td&gt;&lt;/td&gt; tags. /// </summary> /// <param name="header"></param> public abstract void InstantiateInHeader(PlaceHolder ph); /// <summary> /// the controls will have a column added after them and so require each column to be properly wrapped in &lt;td&gt;&lt;/td&gt; tags. The &lt;tr&gt;&lt;/tr&gt; is handled in the base class. /// </summary> /// <param name="ph"></param> public abstract void InstantiateInItem(PlaceHolder ph); /// <summary> /// the controls will have a column added after them and so require each column to be properly wrapped in &lt;td&gt;&lt;/td&gt; tags. The &lt;tr&gt;&lt;/tr&gt; is handled in the base class. /// </summary> /// <param name="ph"></param> public abstract void InstantiateInAlternatingItem(PlaceHolder ph); /// <summary> /// the controls will have a column added after them and so require each column to be properly wrapped in &lt;td&gt;&lt;/td&gt; tags. The &lt;tr&gt;&lt;/tr&gt; is handled in the base class. /// </summary> /// <param name="ph"></param> public abstract void InstantiateInEdit(PlaceHolder ph); /// <summary> /// Any html used in the footer will have &lt;/tr&gt;&lt;table&gt; appended to the end. /// &lt;tr&gt; will be appended to the front. /// </summary> /// <param name="ph"></param> public abstract void InstantiateInFooter(PlaceHolder ph); /// <summary> /// the controls will have a column added after them and so require each column to be properly wrapped in &lt;td&gt;&lt;/td&gt; tags. The &lt;tr&gt;&lt;/tr&gt; is handled in the base class. /// Adds Delete and Edit Buttons after the table contents. /// </summary> /// <param name="ph"></param> public abstract void InstantiateInSelectedItem(PlaceHolder ph); /// <summary> /// The base class provides no &lt;tr&gt;&lt;/tr&gt; tags /// </summary> /// <param name="ph"></param> public abstract void InstantiateInSeperator(PlaceHolder ph); /// <summary> /// Use this method to bind the controls to their data. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public abstract void DataBindingOverride(object sender, EventArgs e); #endregion } Inheriting class: public class NominalGroupTemplate : BaseTemplate { public NominalGroupTemplate(ListItemType theListItemType) : base(theListItemType) { } public override void InstantiateInHeader(PlaceHolder ph) { ph.Controls.Add(new LiteralControl(@"<td>ID</td><td>Group</td><td>IsPositive</td>")); } public override void InstantiateInItem(PlaceHolder ph) { ph.Controls.Add(new LiteralControl(@"<td>")); Label lblID = new Label(); lblID.ID = "lblID"; ph.Controls.Add(lblID); ph.Controls.Add(new LiteralControl(@"</td><td>")); Label lblGroup = new Label(); lblGroup.ID = "lblGroup"; ph.Controls.Add(lblGroup); ph.Controls.Add(new LiteralControl(@"</td><td>")); CheckBox chkIsPositive = new CheckBox(); chkIsPositive.ID = "chkIsPositive"; chkIsPositive.Enabled = false; ph.Controls.Add(chkIsPositive); ph.Controls.Add(new LiteralControl(@"</td>")); } public override void InstantiateInAlternatingItem(PlaceHolder ph) { InstantiateInItem(ph); } public override void InstantiateInEdit(PlaceHolder ph) { ph.Controls.Add(new LiteralControl(@"<td>")); Label lblID = new Label(); lblID.ID = "lblID"; ph.Controls.Add(lblID); ph.Controls.Add(new LiteralControl(@"</td><td>")); TextBox txtGroup = new TextBox(); txtGroup.ID = "txtGroup"; txtGroup.Visible = true; txtGroup.Enabled = true ; ph.Controls.Add(txtGroup); ph.Controls.Add(new LiteralControl(@"</td><td>")); CheckBox chkIsPositive = new CheckBox(); chkIsPositive.ID = "chkIsPositive"; chkIsPositive.Visible = true; chkIsPositive.Enabled = true ; ph.Controls.Add(chkIsPositive); ph.Controls.Add(new LiteralControl(@"</td>")); } public override void InstantiateInFooter(PlaceHolder ph) { InstantiateInHeader(ph); } public override void InstantiateInSelectedItem(PlaceHolder ph) { ph.Controls.Add(new LiteralControl(@"<td>")); Label lblID = new Label(); lblID.ID = "lblID"; ph.Controls.Add(lblID); ph.Controls.Add(new LiteralControl(@"</td><td>")); TextBox txtGroup = new TextBox(); txtGroup.ID = "txtGroup"; txtGroup.Visible = true; txtGroup.Enabled = false; ph.Controls.Add(txtGroup); ph.Controls.Add(new LiteralControl(@"</td><td>")); CheckBox chkIsPositive = new CheckBox(); chkIsPositive.ID = "chkIsPositive"; chkIsPositive.Visible = true; chkIsPositive.Enabled = false; ph.Controls.Add(chkIsPositive); ph.Controls.Add(new LiteralControl(@"</td>")); } public override void InstantiateInSeperator(PlaceHolder ph) { } public override void DataBindingOverride(object sender, EventArgs e) { PlaceHolder ph = (PlaceHolder)sender; DataListItem li = (DataListItem)ph.NamingContainer; int id = Convert.ToInt32(DataBinder.Eval(li.DataItem, "ID")); string group = (string)DataBinder.Eval(li.DataItem, "Group"); bool isPositive = Convert.ToBoolean(DataBinder.Eval(li.DataItem, "IsPositive")); switch (this.ListItemType) { case ListItemType.Item: case ListItemType.AlternatingItem: { ((Label)ph.FindControl("lblID")).Text = id.ToString(); ((Label)ph.FindControl("lblGroup")).Text = group; ((CheckBox)ph.FindControl("chkIsPositive")).Text = isPositive.ToString(); break; } case ListItemType.EditItem: case ListItemType.SelectedItem: { ((TextBox)ph.FindControl("lblID")).Text = id.ToString(); ((TextBox)ph.FindControl("txtGroup")).Text = group; ((CheckBox)ph.FindControl("chkIsPositive")).Text = isPositive.ToString(); break; } } } } From here I added the control to a page the code behind public partial class NominalGroupbroke : System.Web.UI.UserControl { public void SetNominalGroupList(IList<BONominalGroup> theNominalGroups) { XElement data = Serialiser<BONominalGroup>.SerialiseObjectList(theNominalGroups); ViewState.Add("nominalGroups", data.ToString()); dlNominalGroup.DataSource = theNominalGroups; dlNominalGroup.DataBind(); } protected void Page_init() { dlNominalGroup.HeaderTemplate = new NominalGroupTemplate(ListItemType.Header); dlNominalGroup.ItemTemplate = new NominalGroupTemplate(ListItemType.Item); dlNominalGroup.AlternatingItemTemplate = new NominalGroupTemplate(ListItemType.AlternatingItem); dlNominalGroup.SeparatorTemplate = new NominalGroupTemplate(ListItemType.Separator); dlNominalGroup.SelectedItemTemplate = new NominalGroupTemplate(ListItemType.SelectedItem); dlNominalGroup.EditItemTemplate = new NominalGroupTemplate(ListItemType.EditItem); dlNominalGroup.FooterTemplate = new NominalGroupTemplate(ListItemType.Footer); } protected void Page_Load(object sender, EventArgs e) { dlNominalGroup.ItemCommand += new DataListCommandEventHandler(dlNominalGroup_ItemCommand); } void dlNominalGroup_Init(object sender, EventArgs e) { dlNominalGroup.HeaderTemplate = new NominalGroupTemplate(ListItemType.Header); dlNominalGroup.ItemTemplate = new NominalGroupTemplate(ListItemType.Item); dlNominalGroup.AlternatingItemTemplate = new NominalGroupTemplate(ListItemType.AlternatingItem); dlNominalGroup.SeparatorTemplate = new NominalGroupTemplate(ListItemType.Separator); dlNominalGroup.SelectedItemTemplate = new NominalGroupTemplate(ListItemType.SelectedItem); dlNominalGroup.EditItemTemplate = new NominalGroupTemplate(ListItemType.EditItem); dlNominalGroup.FooterTemplate = new NominalGroupTemplate(ListItemType.Footer); } void dlNominalGroup_DataBinding(object sender, EventArgs e) { } void deleteNominalGroup(int index) { XElement data = XElement.Parse(Convert.ToString( ViewState["nominalGroups"] )); IList<BONominalGroup> list = Serialiser<BONominalGroup>.DeserialiseObjectList(data); FENominalGroup.DeleteNominalGroup(list[index].ID); list.RemoveAt(index); data = Serialiser<BONominalGroup>.SerialiseObjectList(list); ViewState["nominalGroups"] = data.ToString(); dlNominalGroup.DataSource = list; dlNominalGroup.DataBind(); } void updateNominalGroup(DataListItem theItem) { XElement data = XElement.Parse(Convert.ToString( ViewState["nominalGroups"])); IList<BONominalGroup> list = Serialiser<BONominalGroup>.DeserialiseObjectList(data); BONominalGroup old = list[theItem.ItemIndex]; BONominalGroup n = new BONominalGroup(); byte id = Convert.ToByte(((TextBox)theItem.FindControl("lblID")).Text); string group = ((TextBox)theItem.FindControl("txtGroup")).Text; bool isPositive = Convert.ToBoolean(((CheckBox)theItem.FindControl("chkIsPositive")).Text); n.ID = id; n.Group = group; n.IsPositive = isPositive; FENominalGroup.UpdateNominalGroup(old, n); list[theItem.ItemIndex] = n; data = Serialiser<BONominalGroup>.SerialiseObjectList(list); ViewState["nominalGroups"] = data.ToString(); } void dlNominalGroup_ItemCommand(object source, DataListCommandEventArgs e) { DataList l = (DataList)source; switch (e.CommandName) { case "SelectRow": { if (l.EditItemIndex == -1) { l.SelectedIndex = e.Item.ItemIndex; l.EditItemIndex = -1; } break; } case "EditRow": { if (l.SelectedIndex == e.Item.ItemIndex) { l.EditItemIndex = e.Item.ItemIndex; } break; } case "DeleteRow": { deleteNominalGroup(e.Item.ItemIndex); l.EditItemIndex = -1; try { l.SelectedIndex = e.Item.ItemIndex; } catch { l.SelectedIndex = -1; } break; } case "CancelRow": { l.SelectedIndex = l.EditItemIndex; l.EditItemIndex = -1; break; } case "SaveRow": { updateNominalGroup(e.Item); try { l.SelectedIndex = e.Item.ItemIndex; } catch { l.SelectedIndex = -1; } l.EditItemIndex = -1; break; } } } Lots of code there, I'm afraid, but it should build. Thanks if anyone manages to spot my silliness. The BONominalGroup class (please ignore my crazy getHash override, I'm not proud of it). IAudit can just be an empty interface here and all will be fine. It used to inherit from another class, I have cleaned that out - so the serialization logic may be broken here. public class BONominalGroup { public BONominalGroup() #region Fields and properties private Int16 _ID; public Int16 ID { get { return _ID; } set { _ID = value; } } private string _group; public string Group { get { return _group; } set { _group = value; } } private bool _isPositve; public bool IsPositive { get { return _isPositve; } set { _isPositve = value; } } #endregion public override bool Equals(object obj) { bool retVal = false; BONominalGroup ng = obj as BONominalGroup; if (ng!=null) if (ng._group == this._group && ng._ID == this.ID && ng.IsPositive == this.IsPositive) { retVal = true; } return retVal; } public override int GetHashCode() { return ToString().GetHashCode(); } public override string ToString() { return "BONominalGroup{ID:" + this.ID.ToString() + ",Group:" + this.Group.ToString() + ",IsPositive:" + this.IsPositive.ToString() + "," + "}"; } #region IXmlSerializable Members public override void ReadXml(XmlReader reader) { reader.ReadStartElement("BONominalGroup"); this.ID = Convert.ToByte(reader.ReadElementString("id")); this.Group = reader.ReadElementString("group"); this.IsPositive = Convert.ToBoolean(reader.ReadElementString("isPositive")); base.ReadXml(reader); reader.ReadEndElement(); } public override void WriteXml(XmlWriter writer) { writer.WriteElementString("id", this.ID.ToString()); writer.WriteElementString("group", this.Group); writer.WriteElementString("isPositive", this.IsPositive.ToString()); // writer.WriteStartElement("BOBase"); // base.WriteXml(writer); writer.WriteEndElement(); } #endregion }

    Read the article

< Previous Page | 1 2 3 4 5