Search Results

Search found 1705 results on 69 pages for 'runat'.

Page 6/69 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Need help with a simple ASP.NET ModalPopupExtender example

    - by remdao
    I'm new to ASP.NET and I'm trying to get this Ajax ModalPopupExtender working. This is an example i found on the net, but nothing happens when btnpopup is clicked. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ModalTestProject._Default" %> <!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 runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <asp:scriptmanager id="ScriptManager1" runat="server"> </asp:scriptmanager> <asp:Button ID="btnpopup" runat="server" Text="Button" /> <ajaxToolkit:ModalPopupExtender ID="mpe" runat="server" TargetControlID="btnpopup" PopupControlID="pnlpopup" CancelControlID="btnCancelpopup" EnableViewState="true" DropShadow="true" /> <asp:Panel ID="pnlpopup" runat="server" Width="400px"> test <asp:Button ID="btnCancelpopup" runat="server" Text="Button" /> </asp:Panel> </form> </body> </html>

    Read the article

  • Textarea (asp:Textbox TextMode="Multiline") overlapping buttons

    - by Gogster
    Hi all, I'm having this problem with form buttons overlapping an asp:Texbox with TextMode set to multi-line: Here is the code: <asp:Panel ID="pnlGiftStep" Visible="false" runat="server"> <img src="/images/shopping-cart/form-separator.png" alt="separator" /> <div class="form-title">GIFT OPTIONS</div> <div class="row"> <asp:TextBox ID="txtGiftName" Height="31" Width="323" BorderStyle="None" Font-Names="Arial" Font-Size="116.7%" runat="server"></asp:TextBox> <cc1:TextBoxWatermarkExtender ID="wmeGiftName" TargetControlID="txtGiftName" WatermarkText="Gift Name" WatermarkCssClass="watermark" runat="server"></cc1:TextBoxWatermarkExtender> </div> <br class="clear" /> <div class="row"> <asp:TextBox ID="txtGiftMessage" Rows="5" Width="323" BorderStyle="None" Font-Names="Arial" TextMode="MultiLine" Font-Size="116.7%" runat="server"></asp:TextBox> <cc1:TextBoxWatermarkExtender ID="wmeGiftMessage" TargetControlID="txtGiftMessage" WatermarkText="Gift Message" WatermarkCssClass="watermark" runat="server"></cc1:TextBoxWatermarkExtender> </div> <br class="clear" /> <div class="button-row"> <asp:ImageButton ID="imbShippingDetails" ImageUrl="/images/shopping-cart/ship-details-btn.png" OnClick="ReturnToShipping" ValidationGroup="shipping" runat="server" /> <asp:ImageButton ID="imbPayDetails" ImageUrl="/images/shopping-cart/pay-details-btn.png" ValidationGroup="pay" runat="server" /> </div> <br class="clear" /> </asp:Panel> Here is the CSS: .row { float:left; height:40px; } .button-row { float:left; width:323px; text-align:right; } Any ideas how I can stop this? Thanks.

    Read the article

  • Execute client & server side code with one click?

    - by Abu Hamzah
    i am not sure if my design have flaw but would like to know what others have to say, i am in a situation where i am trying to acheive two things in one click. using : asp.net web form i have a web form with few textbox and a gridview control and a button. if i click on the button i am executing two things 1) asynchronously get data from server to client (working great) and able to display the data in the textboxes. 2) same click i want to bind the gridview. <asp:Content ID="Content2" ContentPlaceHolderID="cphMaster" runat="server"> <asp:Label runat="server" ID='Label1' >Id:</asp:Label> <asp:TextBox ID="txtId" runat='server'></asp:TextBox> <asp:Button ID="btnSubmit" OnClientClick="LoadDataById();" runat="server" Text="Submit" onclick="btnSubmit_Click" /> <br /> <br /> <asp:TextBox ID="txtName" runat='server'></asp:TextBox> <br /> <asp:TextBox ID="txtPurpose" runat='server'></asp:TextBox> <br /> <br /> <asp:GridView ID="GridView1" runat="server"> </asp:GridView> </asp:Content> server side protected void btnSubmit_Click(object sender, EventArgs e) { GridView1.DataSource = laodData(int.Parse(txtId.Text)); GridView1.DataBind(); } Jquery: function LoadVisitBasicByVisitId() { ContactServiceProxy.invoke({ serviceMethod: "GetDataById", data: { request: request }, callback: function(response) { processCompletedContactStore(response); }, error: function(xhr, errorMsg, thrown) { postErrorAndUnBlockUI(xhr, errorMsg, thrown); } }); return false; } recap: 1) jquery script execute asynchronously to get data from server to client and display in the textboxes 2) server side code to bind the gridview.

    Read the article

  • Databind gridview with LINQ

    - by Anders Svensson
    I have two database tables, one for Users of a web site, containing the fields "UserID", "Name" and the foreign key "PageID". And the other with the fields "PageID" (here the primary key), and "Url". I want to be able to show the data in a gridview with data from both tables, and I'd like to do it with databinding in the aspx page. I'm not sure how to do this, though, and I can't find any good examples of this particular situation. Here's what I have so far: <%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="LinqBinding._Default" %> <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> </asp:Content> <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <h2> Testing LINQ </h2> <asp:GridView ID="GridView1" runat="server" DataSourceID="LinqDataSourceUsers" AutoGenerateColumns="false"> <Columns> <asp:CommandField ShowSelectButton="True" /> <asp:BoundField DataField="UserID" HeaderText="UserID" /> <asp:BoundField DataField="Name" HeaderText="Name" /> <asp:BoundField DataField="PageID" HeaderText="PageID" /> <asp:TemplateField HeaderText="Pages"> <ItemTemplate <asp:DropDownList ID="DropDownList1" DataSourceID="LinqDataSourcePages" SelectedValue='<%#Bind("PageID") %>' DataTextField="Url" DataValueField="PageID" runat="server"> </asp:DropDownList> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> <asp:LinqDataSource ID="LinqDataSourcePages" runat="server" ContextTypeName="LinqBinding.UserDataContext" EntityTypeName="" TableName="Pages"> </asp:LinqDataSource> <asp:LinqDataSource ID="LinqDataSourceUsers" runat="server" ContextTypeName="LinqBinding.UserDataContext" EntityTypeName="" TableName="Users"> </asp:LinqDataSource> </asp:Content> But this only works in so far as it gets the user table into the gridview (that's not a problem), and I get the page data into the dropdown, but here's the problem: I of course get ALL the page data in there, not just the pages for each user on each row. So how do I put some sort of "where" constraint on dropdown for each row to only show the pages for the user in that row? (Also, to be honest I'm not sure I'm getting the foreign key relationship right, because I'm not too used to working with relationships). EDIT: I think I have set up the relationship incorrectly. I keep getting the message that "Pages" doesn't exist as a property on the User object. And I guess it can't since the relationship right now is one way. So I tried to create a many-to-many relationship. Again, my database knowledge is a bit limited, but I added a so called "junction table" with the fields UserID and PageID, same as the other tables' primary keys. I wasn't able to make both of these primary keys in the junction table though (which it looked like some people had in examples I've seen...but since it wasn't possible I guessed they shouldn't be). Anyway, I created a relationship from each table and created new LINQ classes from that. But then what do I do? I set the junction table as the Linq data source, since I guessed I had to do this to access both tables, but that doesn't work. Then it complains there is no Name property on that object. So how do I access the related tables? Here's what I have now with the many-to-many relationship: <%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ManyToMany._Default" %> <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> </asp:Content> <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <h2> Many to many LINQ </h2> <asp:GridView ID="GridView1" runat="server" DataSourceID="LinqDataSource1" AutoGenerateColumns="false"> <Columns> <asp:CommandField ShowSelectButton="True" /> <asp:BoundField DataField="UserID" HeaderText="UserID" /> <asp:BoundField DataField="Name" HeaderText="Name" /> <asp:BoundField DataField="PageID" HeaderText="PageID" /> <asp:TemplateField HeaderText="Pages"> <ItemTemplate> <asp:DropDownList ID="DropDownList1" DataSource='<%#Eval("Pages") %>' SelectedValue='<%#Bind("PageID") %>' DataTextField="Url" DataValueField="PageID" runat="server"> </asp:DropDownList> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="ManyToMany.UserPageDataContext" EntityTypeName="" TableName="UserPages"> </asp:LinqDataSource> </asp:Content>

    Read the article

  • Expression Web 4 - Master Page Error

    - by Eric J.
    I created an ASP.Net Web Application in VS 2010. That in turn creates an example Site.Master, Default.aspx, and several other example files. I then opened Default.aspx in Expression Web 4 and get the error message The Master Page file 'Site.Master' cannot be loaded. Default.aspx can still be displayed fine in VS 2010. Source.Master: <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="SampleWebApp.SiteMaster" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head runat="server"> <title></title> <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" /> <asp:ContentPlaceHolder ID="HeadContent" runat="server"> </asp:ContentPlaceHolder> <style type="text/css"> .style1 { font-family: Tunga; } </style> </head> <body> <form runat="server"> <div class="page"> <div class="header"> <div class="title"> <h1 class="style1"> My Application Master Page</h1> </div> <div class="loginDisplay"> <asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false"> <AnonymousTemplate> [ <a href="~/Account/Login.aspx" ID="HeadLoginStatus" runat="server">Log In</a> ] </AnonymousTemplate> <LoggedInTemplate> Welcome <span class="bold"><asp:LoginName ID="HeadLoginName" runat="server" /></span>! [ <asp:LoginStatus ID="HeadLoginStatus" runat="server" LogoutAction="Redirect" LogoutText="Log Out" LogoutPageUrl="~/"/> ] </LoggedInTemplate> </asp:LoginView> </div> <div class="clear hideSkiplink"> <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal"> <Items> <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home"> <asp:MenuItem NavigateUrl="~/Home/NewItem.aspx" Text="New Item" Value="New Item"></asp:MenuItem> <asp:MenuItem NavigateUrl="~/Home/AnotherItem.aspx" Text="Another Item" Value="Another Item"></asp:MenuItem> </asp:MenuItem> <asp:MenuItem NavigateUrl="~/About.aspx" Text="About"/> <asp:MenuItem NavigateUrl="~/ContactUs.aspx" Text="ContactUs" Value="ContactUs"> </asp:MenuItem> </Items> </asp:Menu> </div> </div> <div class="main"> <asp:ContentPlaceHolder ID="MainContent" runat="server"/> </div> <div class="clear"> </div> </div> <div class="footer"> </div> </form> </body> </html> Default.aspx: <%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="SampleWebApp._Default" %> <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> <style type="text/css"> .style2 { color: #669900; } .style3 { background-color: #FFFFCC; } </style> </asp:Content> <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <h2> Welcome to MY page! </h2> <p> To learn more <span class="style2"><strong><em><span class="style3">about</span></em></strong></span> ASP.NET visit <a href="http://www.asp.net" title="ASP.NET Website">www.asp.net</a>. </p> <p> You can also find <a href="http://go.microsoft.com/fwlink/?LinkID=152368&amp;clcid=0x409" title="MSDN ASP.NET Docs">documentation on ASP.NET at MSDN</a>. </p> </asp:Content> Any idea how to get the master page to work properly in Expression Web 4?

    Read the article

  • ASP.NET panel DefaultButton event fires only once?

    - by Ahmed
    For a panel with one textbox and one button which is its default button, the DefaultButton event fires only once as editing textbox details again and pressing enter, event doesn't fire. <asp:Panel runat="server" ID="pnlNewFolderDetails" DefaultButton="btnAddFolder"> <asp:Label runat="server" ID="lblFolderHeader" Text="New Folder Name" CssClass="label" /> <asp:TextBox runat="server" ID="txtFolderName" ToolTip="Folder Name" /> <asp:Button runat="server" ID="btnAddFolder" OnClick="btnAddFolder_Click" Text="Add" /> Any suggestions?

    Read the article

  • Unnecessary scroll bars appearing in IE8

    - by Abhishek Jain
    Hi, In my web app there is a page(ChildPage) which is actually contained in an iframe element of another page(ParentPage). This ChildPage has its contents placed in ContentPlaceHolder of a MasterPage. <div id="DivScroll" runat="server" style="overflow-y: auto; overflow-x: auto; width: 100%; height: 100%;"> <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder> </div> As apparent in the code, contents of ChildPage are scrollable in the div containing it. There is never the need for the scroll bars of browser to appear and it is working this way till IE7. In IE8 browser scrollbras are appearing due to the presence of the following div in ChildPage. <div class="ReadOnlyFlat" id="Div1" style="z-index: 100; visibility: hidden; overflow: auto; width: 100%; position: absolute; height: 300px" runat="server" ms_positioning="FlowLayout"> <radA:RadAjaxPanel ID="RadAjaxPanelA" EnableOutsideScripts="True" runat="server"> <radT:RadTreeView ID="RadTreeView2" TabIndex="1" runat="server" Skin="web20"> <NodeTemplate> <asp:Label ID="Label2" runat="server">Label</asp:Label> <asp:Label ID="Label4" runat="server" Width="10px"></asp:Label> <asp:Label ID="Label3" runat="server" ForeColor="#FF8000" Font-Bold="True">Label</asp:Label> </NodeTemplate> </radT:RadTreeView> </radA:RadAjaxPanel> What actually happens in IE8 is as follows: The above div Div1 is diaplyed on the click of an ImageButton. On the page load this ImageButton is present on the bottom of the page. In this case IE8 shows browser's vertical scrollbar due to height of Div1. When I scroll DivScroll shown in first code snippet, the ImageButton moves up. When the ImageButton is moved sufficiently up so that it is above the bottommost part of page by more than 300px(i.e, the height of Div1) and if I click the ImageButton, the browser's vertical scrollbars disappear. Browser's vertical scrollbar appears in case the distance between ImageButton and the bottom most part of page is less than height of Div1 and disappears when the distance is more than height of Div1. I need that the browser's vertical scrollbar never appears. Please Help.

    Read the article

  • ASP.NET FormView: "Object of type 'System.Int32' cannot be converted to type 'System.String"

    - by Vinzcent
    Hey I have a problem with my FromView. I would like to show some data from a Database Table in my FormView. But some data is from the tupe Int32, while this data should be in a TextBox, a string. How do you convert these Int32's. FormView and my ObjectDataSource <asp:FormView ID="fvDetailOrder" runat="server"> <ItemTemplate> Aantal:<br /> <asp:Label CssClass="txtBox" ID="Label15" runat="server" Text='<%# Eval("COUNT") %>' /><br /> Prijs:<br /> <asp:Label CssClass="txtBox" ID="Label16" runat="server" Text='<%# Eval("PRICE") %>' /><br /> Korting:<br /> <asp:Label CssClass="txtBox" ID="Label17" runat="server" Text='' /><br /> Totaal:<br /> <asp:Label CssClass="txtBox" ID="Label18" runat="server" Text='<%# Eval("AMOUNT") %>' /><br /> Betaald:<br /> <asp:Label CssClass="txtBox" ID="Label19" runat="server" Text='<%# Eval("PAID") %>' /><br /> Datum betaling:<br /> <asp:Label CssClass="txtBox" ID="Label20" runat="server" Text='<%# Eval("PDATE") %>' /><br /> </ItemTemplate> </asp:FormView> <asp:ObjectDataSource ID="objdsOrderID" runat="server" OnSelecting="objdsOrderID_Selecting" SelectMethod="getOrdersByID" TypeName="DAL.OrdersDAL"> <SelectParameters> <asp:Parameter Name="id" Type="Int32" /> </SelectParameters> </asp:ObjectDataSource> My Code behind protected void gvOrdersAdmin_SelectedIndexChanged(object sender, EventArgs e) { fvDetailOrder.DataSource = objdsOrderID; fvDetailOrder.DataBind(); // <-- HERE I GET THE ERROR } protected void objdsOrderID_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) { e.InputParameters["id"] = gvOrdersAdmin.DataKeys[gvOrdersAdmin.SelectedRow.RowIndex].Values[0]; ; } My Data Acces Layer public static DataTable getOrdersByID(string id) { string sql = "SELECT 'AUTHOR' = tblAuthors.FIRSTNAME + ' ' + tblAuthors.LASTNAME, tblBooks.*, tblGenres.*, tblLanguages.*, tblOrders.* FROM tblAuthors INNER JOIN tblBooks ON tblAuthors.AUTHOR_ID = tblBooks.AUTHOR_ID INNER JOIN tblGenres ON tblBooks.GENRE_ID = tblGenres.GENRE_ID INNER JOIN tblLanguages ON tblBooks.LANG_ID = tblLanguages.LANG_ID INNER JOIN tblOrders ON tblBooks.BOOK_ID = tblOrders.BOOK_ID" + " WHERE tblOrders.ID = @id;"; SqlDataAdapter da = new SqlDataAdapter(sql, GetConnectionString()); da.SelectCommand.Parameters["id"].Value = id; DataSet ds = new DataSet(); da.Fill(ds, "Orders"); return ds.Tables["Orders"]; } Thanks a lot, Vincent

    Read the article

  • jquery ui tabs redirecting to ASPX page on postbacks

    - by neoneo007
    I am being redirected to the actual aspx page when I submit the form. How to avoid the redirection. Tabs.aspx <div id="container-1"> <ul> <li><a href="Survey.aspx?group=1"><span>HR</span></a></li> <li><a href="Survey.aspx?group=2"><span>Sales</span></a></li> <li><a href="Survey.aspx?group=3"><span>Finance</span></a></li> </ul> jquery code in tabs.aspx <script type="text/javascript"> $(function() { $('#container-1 > ul').tabs(); </script> Survey.aspx <form id="form1" runat="server"> <div> <asp:Label ID="lblHeading" runat="server"></asp:Label><br /> <asp:HiddenField ID="hdnGroupId" runat="server" /> <br /> 1) Question 1 <asp:DropDownList ID="DropDownList1" runat="server"> </asp:DropDownList>     <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br /> 2) Another question:  <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br /> <br /> <br /> <asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click" Text="Save" /><br /> <div id="Result">Click here for the time.</div> <asp:Label ID="lblMessage" runat="server"></asp:Label></div> </form> Survey page Code behind protected void btnSave_Click(object sender, EventArgs e) { if (groupId > 0) { switch (groupId) { case 1: lblMessage.Text = "HR data is saved."; break; case 2: lblMessage.Text = "Sales data is saved."; break; case 3: lblMessage.Text = "Finance data is saved."; break; default: break; } } }

    Read the article

  • Appending data into Listview control

    - by strakastroukas
    In my webpage i use the following in order filling the listview control <asp:ListView ID="ListView1" runat="server"> <layouttemplate> <asp:PlaceHolder id="itemPlaceholder" runat="server" /></layouttemplate> <ItemTemplate> <tr> <td><asp:Label ID="Label1" runat="server" Text = '<%# DataBinder.Eval(Container.DataItem, "Ans1") %>' Visible = '<%# DataBinder.Eval(Container.DataItem, "Ans1Visible") %>'></asp:Label> <br /> <asp:Label ID="Label2" runat="server" Text = '<%# DataBinder.Eval(Container.DataItem, "Ans2") %>' Visible = '<%# DataBinder.Eval(Container.DataItem, "Ans2Visible") %>'></asp:Label> <br /> <asp:Label ID="Label3" runat="server" Text = '<%# DataBinder.Eval(Container.DataItem, "Ans3") %>' Visible = '<%# DataBinder.Eval(Container.DataItem, "Ans3Visible") %>'></asp:Label> <br /> <asp:Label ID="Label4" runat="server" Text = '<%# DataBinder.Eval(Container.DataItem, "Ans4") %>' Visible = '<%# DataBinder.Eval(Container.DataItem, "Ans4Visible") %>'></asp:Label> <br /> <asp:Label ID="Label5" runat="server" Text = '<%# DataBinder.Eval(Container.DataItem, "Ans5") %>' Visible = '<%# DataBinder.Eval(Container.DataItem, "Ans5Visible") %>'></asp:Label> <br /> <asp:Label ID="Label6" runat="server" Text = '<%# DataBinder.Eval(Container.DataItem, "Ans6") %>' Visible = '<%# DataBinder.Eval(Container.DataItem, "Ans6Visible") %>'></asp:Label> </td> </tr> </ItemTemplate> </asp:ListView> Now i would like to add numbers to the labels before they are rendered. For example currently the data displayed are like Tennis Football Basketball Nfl Nba Polo and the output i would like to have is 1. Tennis 2. Football 3. Basketball 4. Nfl 5. Nba 6. Polo Could i use ListView1_ItemCreated or the ListView1_ItemDataBound event to achieve this? If that is true, could you point me a place to start?

    Read the article

  • ASP.NET AJAX Doesnt Work

    - by Petras
    I have a very simple AJAX example that doesn't work. It is from the Microsoft tutorials on AJAX. When I click on button "Button1" AJAX should execute but the whole page submits. Here is the code: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="1111.aspx.cs" Inherits="_1111" %> <%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %> <!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 runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <p> DropDownList AutoPostBack SelectedIndexChanged EventArgs Sort ... Since you will be using AJAX to process your SelectedIndexChanged event, set the AutoPostBack property of the DropDownList to false. ...</p> <div> <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"> </asp:ScriptManager> <asp:Label ID="label2" runat="server"></asp:Label><br /> <asp:Label ID="label3" runat="server"></asp:Label><br /> <center> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Label ID="label1" runat="server"></asp:Label> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button 1" /> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" /> </Triggers> </asp:UpdatePanel></center> </div> </form> </body> </html> using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _1111 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { label1.Text = System.DateTime.Now.ToString(); label2.Text = System.DateTime.Now.ToString(); label3.Text = System.DateTime.Now.ToString(); } protected void Button1_Click(object sender, EventArgs e) { label1.Text = System.DateTime.Now.ToString(); } }

    Read the article

  • Header Div Position Edit according to Content Div

    - by Melih Mucuk
    I want to design my web site. I have two main div, one of them "header", other "content". I want to set width property:80% and I set center for both of them. But I don't do that. Other question about header div. I uploaded an image and I want to design like this. How can I do all of them? My CSS: #main { margin:0px auto; margin-left:50px; margin-right:50px; margin-top:25px; margin-bottom:25px; height:auto; text-align:center;} #content { width:80%; height:auto; margin:0px auto; } #header { width:80%; height:100px; top:20px; } #header_left { float:left ; height: 100px; text-align: center; } #header_right { margin:0px auto; height:30px; text-align:center; margin-top:35px; } #header_social { float:right; height:30px; text-align:center; margin-top:35px;} My client code: <div id="main"> <div id="content"> <div id="header"> <div id="header_left"> <asp:Image ID="Image1" runat="server" /> </div> <div id="header_right"> <asp:LinkButton ID="LinkButton5" runat="server" ForeColor="Gray"></asp:LinkButton>&nbsp;| <asp:LinkButton ID="LinkButton4" runat="server" ForeColor="Gray" ></asp:LinkButton>&nbsp;| <asp:LinkButton ID="LinkButton3" runat="server" ForeColor="#FF3300" ></asp:LinkButton>&nbsp;| <asp:LinkButton ID="LinkButton2" runat="server" ForeColor="Gray" ></asp:LinkButton>&nbsp;| <asp:LinkButton ID="LinkButton1" runat="server" ForeColor="Gray" ></asp:LinkButton> </div> <div id="header_social"> <asp:ImageButton ID="ImageButton1" runat="server"/> <asp:ImageButton ID="ImageButton2" runat="server"/> </div> </div> ******CONTENT FIELD***** </div> </div>

    Read the article

  • Appending data into Listview control results

    - by strakastroukas
    In my webpage i use the following in order filling the listview control <asp:ListView ID="ListView1" runat="server"> <layouttemplate> <asp:PlaceHolder id="itemPlaceholder" runat="server" /></layouttemplate> <ItemTemplate> <tr> <td><asp:Label ID="Label1" runat="server" Text = '<%# DataBinder.Eval(Container.DataItem, "Ans1") %>' Visible = '<%# DataBinder.Eval(Container.DataItem, "Ans1Visible") %>'></asp:Label> <br /> <asp:Label ID="Label2" runat="server" Text = '<%# DataBinder.Eval(Container.DataItem, "Ans2") %>' Visible = '<%# DataBinder.Eval(Container.DataItem, "Ans2Visible") %>'></asp:Label> <br /> <asp:Label ID="Label3" runat="server" Text = '<%# DataBinder.Eval(Container.DataItem, "Ans3") %>' Visible = '<%# DataBinder.Eval(Container.DataItem, "Ans3Visible") %>'></asp:Label> <br /> <asp:Label ID="Label4" runat="server" Text = '<%# DataBinder.Eval(Container.DataItem, "Ans4") %>' Visible = '<%# DataBinder.Eval(Container.DataItem, "Ans4Visible") %>'></asp:Label> <br /> <asp:Label ID="Label5" runat="server" Text = '<%# DataBinder.Eval(Container.DataItem, "Ans5") %>' Visible = '<%# DataBinder.Eval(Container.DataItem, "Ans5Visible") %>'></asp:Label> <br /> <asp:Label ID="Label6" runat="server" Text = '<%# DataBinder.Eval(Container.DataItem, "Ans6") %>' Visible = '<%# DataBinder.Eval(Container.DataItem, "Ans6Visible") %>'></asp:Label> </td> </tr> </ItemTemplate> </asp:ListView> Now i would like to add numbers to the labels before they are rendered. For example currently the data displayed are like Tennis Football Basketball Nfl Nba Polo and the output i would like to have is 1. Tennis 2. Football 3. Basketball 4. Nfl 5. Nba 6. Polo Could i use ListView1_ItemCreated or the ListView1_ItemDataBound event to achieve this? If that is true, could you point me a place to start?

    Read the article

  • Asp.net PopupControlExtender inside UpdatePabel

    - by user296422
    Hi, So i use PopupControlExtender (to edit some of the fields) inside ListViewControl which itself is embeded inside an UpdatePanel. The problem is as follows whenever you cause partail postback the popup panels are created client side outside the updatepanel. And you get more clientside controls with the same clientside ID. When you postback with popup panel the server side control eg. Texbox has Text = clientsidecontrol1.text, clientsidecontrol2.text, clientsidecontrol.text3 Is there a way to prevent this. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Secure_Test" %> <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %> <!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 runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> </cc1:ToolkitScriptManager> <div> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Label ID="InputLabel" runat="server" Text="Whatever you put in the textbox"></asp:Label> <br /> <asp:Label runat="server"> <%= DateTime.Now.ToString() %></asp:Label> <br /> <asp:Button ID="Button1" runat="server" Text="Refresh" /> <br /> <asp:LinkButton ID="PopupLB" runat="server">Popup</asp:LinkButton> <br /> <cc1:PopupControlExtender ID="PopupControlExtender1" runat="server" PopupControlID="Panel1" TargetControlID="PopupLB" CommitProperty="Value"> </cc1:PopupControlExtender> <asp:Panel ID="Panel1" runat="server"> <asp:UpdatePanel ID="UpdatePanel2" runat="server"> <ContentTemplate> <asp:TextBox ID="InputTB" runat="server"></asp:TextBox> <asp:Button ID="SubmitBTN" runat="server" Text="Submit" onclick="SubmitBTN_Click" UseSubmitBehavior="false" /> </ContentTemplate> </asp:UpdatePanel> </asp:Panel> </ContentTemplate> </asp:UpdatePanel> </div> </form> </body> </html> using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using AjaxControlToolkit; public partial class Secure_Test : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void SubmitBTN_Click(object sender, EventArgs e) { PopupControlExtender pce = AjaxControlToolkit.PopupControlExtender.GetProxyForCurrentPopup(Page); pce.Commit("Popup"); InputLabel.Text = InputTB.Text; } } To make it easier to test i post the code of an example page i used for testing. To make myself clear here is an example: i click Popup. Type "asdf" in the textbox and click Submit. InputPanel dispalys "asdf" i click Popup again. Type "qwerty" in the textbox and click Submit. InputPanel now displays "qwerty,asdf" When you check it the firebug you get this: <form id="form1" action="Test.aspx" method="post" name="form1"> <div> <input type="hidden" value=";;AjaxControlToolkit, Version=3.0.30930.21526, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e:pl-PL:c83bc095-c5d9-40da-b175-dc46338fcc3a:865923e8:91bd373d:596d588c:411fea1c:e7c87f07:bbfda34c:30a78ec5:42b7c466;" id="ToolkitScriptManager1_HiddenField" name="ToolkitScriptManager1_HiddenField"> </div> <script type="text/javascript"> //&lt;![CDATA[ var theForm = document.forms['form1']; if (!theForm) { theForm = document.form1; } function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } //]]&gt; </script> <script type="text/javascript" src="/WebResource.axd?d=B2RAZw_YugtketKJqWIbXA2&amp;t=634051184591131846"></script> <script type="text/javascript" src="/ScriptResource.axd?d=zifZiisoqXYJSwLXuAZ4DmtrWVvn9x0W1r7qfDo40UU7q9QYoa5ChdBZD6dDL66f0flKVDmPL2woIPesut_FUpsFZUN2A5sDN7IOqPUOZO41&amp;t=1a45d080"></script> <script type="text/javascript"> //&lt;![CDATA[ if (typeof(Sys) === 'undefined') throw new Error('Ladowanie struktury strony klienta ASP.NET Ajax nie powiodlo sie.'); //]]&gt; </script> <script type="text/javascript" src="/ScriptResource.axd?d=zifZiisoqXYJSwLXuAZ4DmtrWVvn9x0W1r7qfDo40UU7q9QYoa5ChdBZD6dDL66fyxEJaYB3uJEQ0r_TmOPczeBZ1gpFH5a6x4ug130lptsKAcGA3S1vt08sHQo5sFtH0&amp;t=1a45d080"></script> <script type="text/javascript" src="/Secure/Test.aspx?_TSM_HiddenField_=ToolkitScriptManager1_HiddenField&amp;_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d3.0.30930.21526%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3apl-PL%3ac83bc095-c5d9-40da-b175-dc46338fcc3a%3a865923e8%3a91bd373d%3a596d588c%3a411fea1c%3ae7c87f07%3abbfda34c%3a30a78ec5%3a42b7c466"></script> <div> </div> <script type="text/javascript"> //&lt;![CDATA[ Sys.WebForms.PageRequestManager._initialize('ToolkitScriptManager1', document.getElementById('form1')); Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tUpdatePanel1','tUpdatePanel2'], [], [], 90); //]]&gt; </script> <div> <div id="UpdatePanel1"> <span id="InputLabel">qwerty,asdf</span> <br> <span>2010-06-15 18:26:50</span> <br> <input type="submit" id="Button1" value="Refresh" name="Button1"> <br> <a href="javascript:__doPostBack('PopupLB','')" id="PopupLB">Popup</a> <br> </div> </div> <script type="text/javascript"> //&lt;![CDATA[ (function() {var fn = function() {$get('ToolkitScriptManager1_HiddenField').value = '';Sys.Application.remove_init(fn);};Sys.Application.add_init(fn);})();Sys.Application.initialize(); Sys.Application.add_init(function() { $create(AjaxControlToolkit.PopupControlBehavior, {"CommitProperty":"Value","PopupControlID":"Panel1","dynamicServicePath":"/Secure/Test.aspx","id":"PopupControlExtender1"}, null, null, $get("PopupLB")); }); //]]&gt; </script> <div id="Panel1" style="position: absolute; left: 8px; top: 73px; z-index: 1000; display: none; visibility: hidden;"> <div id="UpdatePanel2"> <input type="text" id="InputTB" name="InputTB"> <input type="button" id="SubmitBTN" onclick="javascript:__doPostBack('SubmitBTN','')" value="Submit" name="SubmitBTN"> </div> </div><span style="display: none ! important;"><input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value=""></span><span style="display: none ! important;"><input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value=""></span><span style="display: none ! important;"><input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJMTkwNzc2NzAzD2QWAgIDD2QWAgIDD2QWAmYPZBYCAgEPDxYCHgRUZXh0BQtxd2VydHksYXNkZmRkZApLPc2nZUC+UkZsCrByuofHMah5"></span><span style="display: none ! important;"><input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBQLi2qWdAwKM54rGBgKIkJujDQKbjp+pDQKc7v+tArliNtJzeG8HrfsGBBXIViJAUGMz"></span><div id="Panel1" style="visibility: hidden; position: absolute; left: 8px; top: 73px; z-index: 1000; display: none;"> <div id="UpdatePanel2"> <input type="text" id="InputTB" value="asdf" name="InputTB"> <input type="button" id="SubmitBTN" onclick="javascript:__doPostBack('SubmitBTN','')" value="Submit" name="SubmitBTN"> </div> </div><div id="Panel1" style="display: none; visibility: hidden; position: absolute;"> <div id="UpdatePanel2"> <input type="text" id="InputTB" value="qwerty,asdf" name="InputTB"> <input type="button" id="SubmitBTN" onclick="javascript:__doPostBack('SubmitBTN','')" value="Submit" name="SubmitBTN"> </div> </div></form> InputTB and Panel1 where generated 3 time.

    Read the article

  • Keep width even when column changes. (HTML)

    - by Andrew
    I have a login on the left sidebar of my website. When a user is logged in, the sidebar width doesn't remain the same as it was when the user wasn't logged in. Is there a way to keep the width the same? <!-- Start Sidebar --> <td id="sidebar" valign="top" height="400px" style="width: 200px"> <!-- Login Form --> <table id="TABLE2"> <tr> <td valign="top"> <asp:LoginView ID="LoginView1" runat="server"> <LoggedInTemplate> <br /> <br /> You are currently logged in. </LoggedInTemplate> <AnonymousTemplate> <asp:Login ID="Login1" runat="server" BorderPadding="0" BorderStyle="None" BorderWidth="0px" Font-Names="Verdana" Font-Size="0.8em" CreateUserText="Sign Up Now!" CreateUserUrl="http://www.tiltonindustries.com/Tilton/Login/CreateAccount.aspx" Height="1px" PasswordRecoveryText="Forgot your password?" PasswordRecoveryUrl="http://www.tiltonindustries.com/Tilton/Login/ForgotPassword.aspx" TextLayout="TextOnTop" Width="200px" DestinationPageUrl="http://www.tiltonindustries.com/Tilton/default.aspx"> <TitleTextStyle Font-Bold="True" Font-Size="0.9em"/> <InstructionTextStyle Font-Italic="True" ForeColor="Black" /> <TextBoxStyle Font-Size="0.8em" /> <LoginButtonStyle BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#990000" /> <LayoutTemplate> <table border="0" cellpadding="4" cellspacing="0" style="border-collapse: collapse; height: 159px;"> <tr> <td style="height: 176px; width: 135px;"> <table border="0" cellpadding="0" style="width: 219px; height: 1px" id="TABLE1"> <tr> <td align="center" style="font-weight: bold; font-size: 0.9em; color: white; height: 18px; background-color: #990000; text-align: center" colspan="2"> Log In</td> </tr> <tr> <td style="width: 94px; height: 10px;"> </td> <td style="height: 10px; width: 78px;"> </td> </tr> <tr> <td style="width: 94px; height: 20px; text-align: right"> <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label> &nbsp; </td> <td style="height: 20px; text-align: left; width: 78px;"> <asp:TextBox ID="UserName" runat="server" Font-Size="0.9em" EnableViewState="False" Width="100px" MaxLength="20"></asp:TextBox><asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName" ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="ctl01$Login1">*</asp:RequiredFieldValidator></td> </tr> <tr> <td style="width: 94px; text-align: right"> <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label> &nbsp; </td> <td style="text-align: left; width: 78px;"> <asp:TextBox ID="Password" runat="server" Font-Size="0.9em" TextMode="Password" Width="100px"></asp:TextBox><asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password" ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="ctl01$Login1">*</asp:RequiredFieldValidator></td> </tr> <tr> <td style="height: 20px; width: 94px;"> &nbsp;</td> <td style="height: 20px; text-align: left; width: 78px;"> <asp:CheckBox ID="chkRememberMe" runat="server" Text="Remember Me" Width="104px" /></td> </tr> <tr> <td align="center" style="color: red; width: 94px; height: 20px;"> </td> <td align="center" style="color: red; text-align: left; width: 78px; height: 20px;"> <asp:Button ID="LoginButton" runat="server" BorderStyle="Solid" BorderWidth="1px" CommandName="Login" Font-Names="Verdana" Font-Size="1.0 em" Text="Log In" ValidationGroup="ctl01$Login1" Width="59px" BackColor="Gray" BorderColor="Black" Height="20px" /></td> </tr> <tr> <td align="center" style="width: 250px; color: red; height: 35px; text-align: center;" colspan="2"> <asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal></td> </tr> <tr> <td style="height: 26px; width: 94px;"> <asp:HyperLink ID="CreateUserLink" runat="server" NavigateUrl="http://www.tiltonindustries.com/Tilton/Login/CreateAccount.aspx">Sign Up Now!</asp:HyperLink>&nbsp; </td> <td style="width: 78px; height: 26px"> <asp:HyperLink ID="PasswordRecoveryLink" runat="server" NavigateUrl="http://www.tiltonindustries.com/Tilton/Login/ForgotPassword.aspx">Forgot your password?</asp:HyperLink></td> </tr> </table> </td> </tr> </table> </LayoutTemplate> </asp:Login> </AnonymousTemplate> </asp:LoginView> <!-- End Login Form --> <!-- Quick Links --> <br /> <br /> <p style="font-size: 14px; font-weight: bold; color: White"> Quick Links:<br /> </p> <br /> <p id="quicklinks"> <a href="default.aspx">Home</a><br /> <a href="services.aspx">Services</a><br /> <a href="matching.aspx">Color Matching</a><br /> <a href="packaging.aspx">Custom Packaging</a><br /> <a href="decorals.aspx">Decorals</a><br /> <a href="delivery.aspx">Delivery</a><br /> <a href="items.aspx">Items</a><br /> <a href="msds.aspx">MSDS</a><br /> <a href="plant.aspx">Plant Capabilities</a><br /> <a href="standard.aspx">Standard Colors</a><br /> <a href="special.aspx">Special Effects</a><br /> <a href="coatings.aspx">Spray Coatings</a><br /> <a href="warranty.aspx">Warranty</a><br /> <a href="http://www.tiltonindustries.com/Tilton/Login/Login.aspx">My Account</a><br /> <a href="gallery.aspx">Gallery</a><br /> <a href="about.aspx">About</a><br /> <a href="faq.aspx">F.A.Q</a><br /> <a href="links.aspx">Links</a><br /> <a href="careers.aspx">Careers</a><br /> <a href="contact.aspx">Contact</a><br /> <br /> </p> </td> </tr> </table> </td> <!-- End Sidebar -->

    Read the article

  • DualLayout for SharePoint 2010 WCM Quick Start

    - by svdoever
    DualLayout for SharePoint 2010 WCM is a solution to provide you with complete HTML freedom in your SharePoint Server 2010 publishing pages. In this post I provide a quick start guide to get you up and running quickly so you can try it out for yourself. This quick start creates a simple HTML5 site with a page to show-case the basics and the power of DualLayout. We will create the site in its own web application. Normally there are many things you have to do to create a clean start point for your SharePoint 2010 WCM site. All those steps will be provided in later posts. For now we want to give you the minimal set of steps to take to get DualLayout working on your machine. Create an authenticated web application with hostheader cms.html5demo.local on port 80 for the cms side of the site. Click the Create Site Collection link on the Application Created dialog box and create a Site Collection based on the Publishing Portal site template. Before we can click the site link in the Top-Level Site Successfully Created dialog we need to add the new host header cms.html5demo.local to the hosts file. Add the following line to the hosts file: 127.0.0.1        cms.html5demo.local Navigate to the site at http://cms.html5demo.local to see the out-of-the-box example Adventure Works publishing site. Download and add the DualLayout solution package designfactory.duallayout.sps2010.trial.1.2.0.0.wsp to the farm’s solution store: On the Start menu, click All Programs. Click Microsoft SharePoint 2010 Products. Click SharePoint 2010 Management Shell. At the Windows PowerShell command prompt, type the following command:Add-SPSolution -LiteralPath designfactory.duallayout.sps2010.trial.1.2.0.0.wsp In SharePoint 2010 Central Administration deploy the solution to the web application http://cms.html5demo.local. Navigate to the site at http://cms.html5demo.local, and in the Site Settings screen select Site Collection Administration > Site collection features and activate the following feature: Open the site http://cms.html5demo.local in SharePoint Designer 2010. Create a view-mode masterpage html5simple.master with the following code: html5simple.master <%@ Master language="C#" %> <%@ Register Tagprefix="SharePointWebControls" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register TagPrefix="sdl" Namespace="DesignFactory.DualLayout" Assembly="DesignFactory.DualLayout, Version=1.2.0.0, Culture=neutral, PublicKeyToken=077f92bbf864a536" %>   <!DOCTYPE html> <html class="no-js">       <head>         <meta charset="utf-8" />         <meta http-equiv="X-UA-Compatible" content="IE=Edge" />         <title><SharePointWebControls:FieldValue FieldName="Title" runat="server"/></title>           <script type="text/javascript">             document.createElement('header');             document.createElement('nav');             document.createElement('article');             document.createElement('hgroup');             document.createElement('aside');             document.createElement('section');             document.createElement('footer');             document.createElement('figure');             document.createElement('time');         </script>           <asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server"/>     </head>          <body>                  <header>             <div class="logo">Logo</div>             <h1>SiteTitle</h1>             <nav>                 <a href="#">SiteMenu 1</a>                 <a href="#">SiteMenu 2</a>                 <a href="#">SiteMenu 3</a>                 <a href="#">SiteMenu 4</a>                 <a href="#">SiteMenu 5</a>                 <sdl:SwitchToWcmModeLinkButton runat="server" Text="…"/>             </nav>             <div class="tagline">Tagline</div>             <form>                 <label>Zoek</label>                 <input type="text" placeholder="Voer een zoekterm in...">                 <button>Zoek</button>                             </form>           </header>                  <div class="content">             <div class="pageContent">                 <asp:ContentPlaceHolder id="PlaceHolderMain" runat="server" />             </div>         </div>              <footer>             <nav>                 <ul>                     <li><a href="#">FooterMenu 1</a></li>                     <li><a href="#">FooterMenu 2</a></li>                     <li><a href="#">FooterMenu 3</a></li>                     <li><a href="#">FooterMenu 4</a></li>                     <li><a href="#">FooterMenu 5</a></li>                 </ul>             </nav>             <small>Copyright &copy; 2011 Macaw</small>         </footer>     </body> </html> Note that if no specific WCM-mode master page is specified (html5simple-wcm.master), the default v4.master master page will be used in WCM-mode. Create a WCM-mode page layout html5simplePage-wcm.aspx with the following code: html5simplePage-wcm.aspx <%@ Page language="C#"     Inherits="DesignFactory.DualLayout.WcmModeLayoutPage, DesignFactory.DualLayout, Version=1.2.0.0, Culture=neutral, PublicKeyToken=077f92bbf864a536" %> <%@ Register Tagprefix="SharePointWebControls"              Namespace="Microsoft.SharePoint.WebControls"              Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="WebPartPages"              Namespace="Microsoft.SharePoint.WebPartPages"              Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="PublishingWebControls"              Namespace="Microsoft.SharePoint.Publishing.WebControls"              Assembly="Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="PublishingNavigation" Namespace="Microsoft.SharePoint.Publishing.Navigation"              Assembly="Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <asp:Content ContentPlaceholderID="PlaceHolderPageTitle" runat="server">     <SharePointWebControls:FieldValue id="PageTitle" FieldName="Title" runat="server"/> </asp:Content> <asp:Content ContentPlaceholderID="PlaceHolderMain" runat="server"> </asp:Content> Notice the Inherits at line two. Instead of inheriting from Microsoft.SharePoint.Publishing.PublishingLayoutPage we need to inherit from DesignFactory.DualLayout.WcmModeLayoutPage. Create a view-mode page layout html5simplePage.aspx with the following code: html5simplePage.aspx html5simplePage.aspx <%@ Page language="C#"          Inherits="DesignFactory.DualLayout.ViewModeLayoutPage, DesignFactory.DualLayout,                     Version=1.2.0.0, Culture=neutral, PublicKeyToken=077f92bbf864a536" %> <%@ Register Tagprefix="SharePointWebControls"              Namespace="Microsoft.SharePoint.WebControls"              Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="WebPartPages"              Namespace="Microsoft.SharePoint.WebPartPages"              Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="PublishingWebControls"              Namespace="Microsoft.SharePoint.Publishing.WebControls"              Assembly="Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="PublishingNavigation" Namespace="Microsoft.SharePoint.Publishing.Navigation"              Assembly="Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <asp:Content ContentPlaceholderID="PlaceHolderAdditionalPageHead" runat="server" /> <asp:Content ContentPlaceholderID="PlaceHolderMain" runat="server">     The title of the page is: <SharePointWebControls:FieldValue id="PageTitleInContent" FieldName="Title" runat="server"/> </asp:Content> Notice the Inherits at line two. Instead of inheriting from Microsoft.SharePoint.Publishing.PublishingLayoutPage we need to inherit from DesignFactory.DualLayout.ViewModeLayoutPage. Set the html5simple.master master page as the Site Master Page Set the allowed page layouts to the Html5 Simple Page page layout and set the New Page Default Settings also to Html5 Simple Page so new created pages are also of this page layout. Note that the Html5 Simple Page page layout is initially not selectable for New Page Default Settings. Save this configuration page first after selecting the allowed page layouts, then open again and select the default new page. Under Site Actions select the New Page action. Create a page Home.aspx of the default page layout type Html5 Simple Page. Set the new created Home.aspx page as Welcome Page. Navigate to the site http://csm.html5demo.local and see the home page in the WCM display and edit mode. Select Switch to View Mode under Site Actions to see the resulting page in view-mode. Select the three dots (…) at the right side of the menu to switch back to WCM-mode. Have a look at the source view of the resulting web page and admire the clean HTML. No SharePoint specific markup or CSS files! Clean HTML in page <!DOCTYPE html> <html class="no-js">     <head>         <meta charset="utf-8" />         <meta http-equiv="X-UA-Compatible" content="IE=Edge" />         <title>Home</title>         <script type="text/javascript">             document.createElement('header');             document.createElement('nav');             document.createElement('article');             document.createElement('hgroup');             document.createElement('aside');             document.createElement('section');             document.createElement('footer');             document.createElement('figure');             document.createElement('time');         </script>              </head>          <body>                  <header>             <div class="logo">Logo</div>             <h1>SiteTitle</h1>             <nav>                 <a href="#">SiteMenu 1</a>                 <a href="#">SiteMenu 2</a>                 <a href="#">SiteMenu 3</a>                 <a href="#">SiteMenu 4</a>                 <a href="#">SiteMenu 5</a>                 <a href="/Pages/Home.aspx?DualLayout_ShowInWcmMode=true">…</a>             </nav>             <div class="tagline">Tagline</div>             <form>                 <label>Zoek</label>                 <input type="text" placeholder="Voer een zoekterm in...">                 <button>Zoek</button>                             </form>         </header>                  <div class="content">             <div class="pageContent">                      The title of the page is: Home             </div>         </div>              <footer>             <nav>                 <ul>                     <li><a href="#">FooterMenu 1</a></li>                     <li><a href="#">FooterMenu 2</a></li>                     <li><a href="#">FooterMenu 3</a></li>                     <li><a href="#">FooterMenu 4</a></li>                     <li><a href="#">FooterMenu 5</a></li>                 </ul>             </nav>             <small>Copyright &copy; 2011 Macaw</small>         </footer>     </body> </html> <!-- Macaw DesignFactory DualLayout for SharePoint 2010 Trial version --> Note the link at line 37, this link will only be rendered for authenticated users and is our way to switch back to WCM-mode. This concludes our quick start to get DualLayout up an running in a matter of minutes. And what is the result: You can have the full SharePoint 2010 WCM publishing page editing experience to manage the content in your pages. You don’t have to delve into large SharePoint specific master pages and page layouts with a lot of knowledge of the does and don'ts with respect to SharePoint controls, scripts and stylesheets. The end-user gets a clean and light HTML page. Get your fully functional, non-timebombed trial copy of DualLayout and start creating!

    Read the article

  • MVC Page not showing up, 404 not found

    - by mwright
    I have a very simple MVC site that is returning a 404 not found error when trying to load a page at the very beginning. I'm looking for some direction to troubleshoot this problem since there is really nothing to go on from the error message. The error I'm getting is: Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested URL: /Views/Other/Index.aspx Below I have included the code for the various pieces, routing rules are default: routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional} // Parameter defaults ); The site is using nested MasterPages, not sure if this is involved with the problem but trying to include as much detail as possible. I have: Controllers OtherController Views: Shared Folder: Site.Master Other Folder: Other.Master Index.aspx Site.Master Code: <%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %> <!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 runat="server"> <title> <asp:ContentPlaceHolder ID="TitleContent" runat="server" /> </title> </head> <body> <div> <asp:ContentPlaceHolder ID="MainContent" runat="server"> </asp:ContentPlaceHolder> </div> </body> </html> Other.Master Code: <%@ Master Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewMasterPage" %> <asp:Content ID="OtherTitle" ContentPlaceHolderID="TitleContent" runat="server"> OTHER PAGE - MASTER TITLE <asp:ContentPlaceHolder ID="OtherPageTitle" runat="server"> </asp:ContentPlaceHolder> </asp:Content> <asp:Content ID="OtherContent" ContentPlaceHolderID="MainContent" runat="server"> Some other content. <asp:ContentPlaceHolder ID="PageContent" runat="server"> </asp:ContentPlaceHolder> </asp:Content> Index.aspx Code: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Other/Other.Master" Inherits="System.Web.Mvc.ViewPage" %> <asp:Content ID="IndexTitle" ContentPlaceHolderID="OtherTitle" runat="server"> Home </asp:Content> <asp:Content ID="IndexContent" ContentPlaceHolderID="OtherContent" runat="server"> Index content </asp:Content> OtherController Code namespace MVCProject.Controllers { public class OtherController : Controller { // // GET: /Member/ public ActionResult Index() { // Have also tried: // return View("Index", "Other.Master"); return View(); } } }

    Read the article

  • Editing a Gridview row with drop-down lists gets too wide - how can I use popup panels instead?

    - by David
    I have a series of GridViews in a Tab Panel - databound to a generic List of Business Objects. The columns in the Gridview are all similar to the following: <asp:TemplateField HeaderText="Company" SortExpression="Company.ShortName"> <ItemTemplate> <asp:Label ID="lblCompany" runat="server" Text='<%# Bind("Company.ShortName") %>'></asp:Label> </ItemTemplate> <EditItemTemplate> <asp:DropDownList ID="ddlCompany" runat="server"></asp:DropDownList> </EditItemTemplate> </asp:TemplateField> The GridView generates the "Edit" link at the beginning of the row, all the events fire ok. The problem is that the data is getting long. When in 'display mode', it's fine because the GridView control is smart enough to break some text into multiple lines (in particular Project, Title and Worker names can get pretty long). The problem come in editing mode. Drop-down lists DON'T break entries into multiple lines (for obvious reasons). Going into Edit ode on a row in the Gridview can make the Griview expand horizontally to twice the screen size (blowing through the width limits in the Master page and CSS but that's only a related problem). What I need is something like the ModalPopup - but trying to tie it to an ID in an EditItemTemplate gives me errors when the page renders (because the 'ddlXXXX' doesn't exist at the time). In addition I don't know how to dynamically populate the panel so that I can get a response from it (like the ID of the Company they selected). I'm also trying to avoid javascript and would like this to be a 'pure' aspx/code-behind solution (for simplicity's sake among others). All the examples I find are of Modal Popups with the panels pre-defined. Even if it (the popup panel) were something like a list of checkboxes, it could be databound to the SortedList I have ready to go and an OK/Cancel button combination to accept or ignore things. I'm just not sure of what goes where. I'm open to suggestions. Thanks in advance. EDIT: Final solution looks as follows: <asp:TemplateField HeaderText="Company" SortExpression="Company.ShortName"> <ItemTemplate> <asp:Label ID="lblCompany" runat="server" Text='<%# Bind("Company.ShortName") %>'></asp:Label> </ItemTemplate> <EditItemTemplate> <asp:LinkButton ID="lnkCompany" runat="server" Text='<%# Bind("Company.ShortName") %>'></asp:LinkButton> <asp:Panel ID="pnlCompany" runat="server" style="display:none"> <div> <asp:DropDownList ID="ddlCompany" runat="server" ></asp:DropDownList> <br/> <asp:ImageButton ID="btnOKCo" runat="server" ImageUrl="~/Images/greencheck.gif" OnCommand="PopupButton_Command" CommandName="SelectCO" /> <asp:ImageButton ID="btnCxlCo" runat="server" ImageUrl="~/Images/RedX.gif" /> </div> </asp:Panel> <cc1:ModalPopupExtender ID="mpeCompany" runat="server" TargetControlID="lnkCompany" PopupControlID="pnlCompany" BackgroundCssClass="modalBackground" CancelControlID="btnCxlCo" DropShadow="true" PopupDragHandleControlID="pnlCompany" /> </EditItemTemplate> </asp:TemplateField> And in the code-behind, lstIDLabor is the generic List of data lines (of which Company is one of the properties that is also a business object) that is bound to the GridView: Sub PopupButton_Command(ByVal sender As Object, ByVal e As CommandEventArgs) Dim intRow As Integer Dim intVal As Integer RestoreFromSessionVariables() Select Case e.CommandName Case "SelectCO" intRow = grdIDCostLabor.EditIndex Dim ddlCo As DropDownList = CType(grdIDCost.Rows(intRow).FindControl("ddlCompany"), DropDownList) intVal = ddlCo.SelectedValue lstIDLabor(intRow).CompanyID = intVal lstIDLabor(intRow).Company = Company.Read(intVal) Case Else ' End Select MakeSessionVariables() BindGrids() End Sub

    Read the article

  • jQuery Validation in ASP.NET

    - by Abu Hamzah
    i have a strange situation may its a easy fix or something i may be missing but here is the question. i have a asp.net form with master page and my validation works great without any problem but the problems starts when i try to hook my click event to the server side, here is what i meant: i have a form with few fields on it and if the form is empty than it should STOP submitting, otherwise allow me to execute the server side script but its not happening, even my form is in invalid state (i do get error message saying i have to enter the required fileds) but still executing my server side script. i would like to execute my server side script only if the form is in valid state. here is my code: my master page <%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %> <!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 runat="server"> <title>jQuery Validation in ASP.NET Master Page</title> <script src="Scripts/jquery-1.3.2.js" type="text/javascript"></script> <script src="Scripts/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script> <script src="Scripts/jquery.validate.js" type="text/javascript"></script> <asp:ContentPlaceHolder id="head" runat="server"> </asp:ContentPlaceHolder> </head> <body> <form id="form1" runat="server"> <div> <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder> </div> </form> </body> </html> my content page: <%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <script type="text/javascript"> $(document).ready(function() { $("#aspnetForm").validate({ rules: { <%=txtName.UniqueID %>: { minlength: 2, required: true }, <%=txtEmail.UniqueID %>: { required: true, email:true } }, messages: { <%=txtName.UniqueID %>:{ required: "* Required Field *", minlength: "* Please enter atleast 2 characters *" } } }); }); </script> Name: <asp:TextBox ID="txtName" MaxLength="30" runat="server" /><br /> Email: <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox><br /> <asp:Button ID="btnSubmit" runat="server" onclick="SubmitTheForm();" Text="Submit" /> </asp:Content> function SubmitTheForm() { SaveTheForm(); } function SaveTheForm() { debugger; var request = buildNewContactRequest(); ContactServiceProxy.invoke({ serviceMethod: "PostNewContact", data: { request: request }, callback: function(response) { processCompletedContactStore(response); }, error: function(xhr, errorMsg, thrown) { postErrorAndUnBlockUI(xhr, errorMsg, thrown); } }); return false; }

    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

  • Is it possible to reference a linkbotton outside an update panel as the update trigger?

    - by Selase
    I have a page based on a master page and as such i can only see the content place holders i used in the master page showing up in the aspx pages based on the master page. the source code shown below: <%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="CaseAdmin.aspx.cs" Inherits="Prototype4.CaseAdmin" %> <%@PreviousPageType VirtualPath="~/Account/Login.aspx"%> <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"> </asp:Content> <asp:Content ID="CaseRightNews" ContentPlaceHolderID="RightNewsItem" runat="server"> </asp:Content> <asp:Content ID="CaseLeftNav" ContentPlaceHolderID="LeftNavigation" runat="server"> <div style="margin-top:20px; margin-bottom:20px;"> <p class="actionButton"> <asp:LinkButton ID="OpenCaseLinkButton" runat="server" onclick="OpenCaseLinkButton_Click">Open Case</asp:LinkButton> </p> <p class="actionButton"><asp:LinkButton ID="RegisterExhibitLinkButton" runat="server" onclick="RegisterExhibitLinkButton_Click">Register Exhibit</asp:LinkButton> </p> </div> </asp:Content> <asp:Content ID="CaseMainContnt" ContentPlaceHolderID="MainContent" runat="server"> <asp:ScriptManager ID="ScriptManager" runat="server" /> <asp:UpdatePanel ID="CaseMainCntntUpdatePanel" UpdateMode="Conditional" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="" eventname="Click"/> </Triggers> <ContentTemplate> <%--Some text here to inform user to click on the open case botton to display open case form--%> </ContentTemplate> </asp:UpdatePanel> <asp:UpdatePanel runat="server" id="UpdatePanel1" updatemode="Conditional"> <Triggers> <asp:AsyncPostBackTrigger ControlID="" eventname="Click"/> </Triggers> <ContentTemplate> <%--some text here to inform users to click on the add exhibit botton to display add exhibit form--%> </ContentTemplate> </asp:UpdatePanel> </asp:Content> the section of the entire page i wish to change upon update is the (this is the main content of the page). for this reason i placed the updatepanel inside the content place holder since it cant be sitting outside and not wrapped in a content place holder. However, the buttons that i wish to apply the trigger that fires the update to, are in another content place holder(). How can i possibly get those buttons to act as the trigger while changing only what appears in the main content area. Plus, i tried getting the updatepanel to work just so i could see if it does the update well but it turned out really bad. i added some linkbottons in the content template area and used them as the triggers for testing reasons. i tested and the changes took over the entire page in contrast to just appearing in the content area. I actually just wanted to load a form that is created in another asp. page into the main content area... I seriously need help with this... Every little help, detail and information is dearly appreciated... thanks so much in advance

    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

  • FAQ: GridView Calculation with JavaScript - Editable Price Field

    - by Vincent Maverick Durano
    Recently I wrote a series of blog posts that demonstrates how to do calculation in GridView using JavaScripts. You can check the series of posts below: FAQ: GridView Calculation with JavaScript FAQ: GridView Calculation with JavaScript - Formatting and Validation FAQ: GridView Calculation with JavaScript - Displaying Quantity Total Recently a user in the forums is asking how to calculate the total quantity, sub-totals and total amout in GridView  when a user enters the price and quantity in the TextBox field. Obviously the series of post  that I wrote will not work in this case because the price field in those examples are Label (read-only) and not TextBox fields. In this post I'm going to demonstrate how to accomplish this using the same method used in my previous examples. Basically I'm just going to modify the GridView declaration and replace the Label price field with a TextBox so that users can type on it. And finally modify the CalculateTotals() javascript function. Here are the code blocks below: <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title></title> <script type="text/javascript"> function CalculateTotals() { var gv = document.getElementById("<%= GridView1.ClientID %>"); var tb = gv.getElementsByTagName("input"); var lb = gv.getElementsByTagName("span"); var sub = 0; var total = 0; var indexQ = 1; var indexP = 0; var price = 0; var qty = 0; var totalQty = 0; var tbCount = tb.length / 2; for (var i = 0; i < tbCount; i++) { if (tb[i].type == "text") { ValidateNumber(tb[i + indexQ]); sub = parseFloat(tb[i + indexP].value) * parseFloat(tb[i + indexQ].value); if (isNaN(sub)) { lb[i].innerHTML = "0.00"; sub = 0; } else { lb[i].innerHTML = FormatToMoney(sub, "$", ",", "."); ; } if (isNaN(tb[i + indexQ].value) || tb[i + indexQ].value == "") { qty = 0; } else { qty = tb[i + indexQ].value; } totalQty += parseInt(qty); total += parseFloat(sub); indexQ++; indexP++; } } lb[lb.length - 2].innerHTML = totalQty; lb[lb.length -1].innerHTML = FormatToMoney(total, "$", ",", "."); } function ValidateNumber(o) { if (o.value.length > 0) { o.value = o.value.replace(/[^\d]+/g, ''); //Allow only whole numbers } } function isThousands(position) { if (Math.floor(position / 3) * 3 == position) return true; return false; }; function FormatToMoney(theNumber, theCurrency, theThousands, theDecimal) { var theDecimalDigits = Math.round((theNumber * 100) - (Math.floor(theNumber) * 100)); theDecimalDigits = "" + (theDecimalDigits + "0").substring(0, 2); theNumber = "" + Math.floor(theNumber); var theOutput = theCurrency; for (x = 0; x < theNumber.length; x++) { theOutput += theNumber.substring(x, x + 1); if (isThousands(theNumber.length - x - 1) && (theNumber.length - x - 1 != 0)) { theOutput += theThousands; }; }; theOutput += theDecimal + theDecimalDigits; return theOutput; } </script> </head> <body> <form id="form1" runat="server"> <asp:gridview ID="GridView1" runat="server" ShowFooter="true" AutoGenerateColumns="false"> <Columns> <asp:BoundField DataField="RowNumber" HeaderText="Row Number" /> <asp:BoundField DataField="Description" HeaderText="Item Description" /> <asp:TemplateField HeaderText="Item Price"> <ItemTemplate> <asp:TextBox ID="TXTPrice" runat="server" onkeyup="CalculateTotals();"></asp:TextBox> </ItemTemplate> <FooterTemplate> <b>Total Qty:</b> </FooterTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Quantity"> <ItemTemplate> <asp:TextBox ID="TXTQty" runat="server" onkeyup="CalculateTotals();"></asp:TextBox> </ItemTemplate> <FooterTemplate> <asp:Label ID="LBLQtyTotal" runat="server" Font-Bold="true" ForeColor="Blue" Text="0" ></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b>Total Amount:</b> </FooterTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Sub-Total"> <ItemTemplate> <asp:Label ID="LBLSubTotal" runat="server" ForeColor="Green" Text="0.00"></asp:Label> </ItemTemplate> <FooterTemplate> <asp:Label ID="LBLTotal" runat="server" ForeColor="Green" Font-Bold="true" Text="0.00"></asp:Label> </FooterTemplate> </asp:TemplateField> </Columns> </asp:gridview> </form> </body> </html>   That's it! I hope someone find this post useful! Technorati Tags: ASP.NET,GridView,JavaScript

    Read the article

  • problem with sqldatasource and data binding

    - by Alexander
    I am trying to pull out data from the table I had from the database according to the id which is passed from the URL. However I always get data from id= 1? Why? FYI I took this code directly from the ClubWebsite starter kit and copy and paste it to my project to make several changes, the ClubWebsite one worked fine.. but this one doesn't and can't find any reason why because they both looked exactly the same. <%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Events_View.aspx.cs" Inherits="Events_View" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="splash" Runat="Server"> <div id="splash4">&nbsp;</div> </asp:Content> <asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <div id="content"> <div class="post"> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ClubDatabase %>" SelectCommand="SELECT dbo.Events.id, dbo.Events.starttime, dbo.events.endtime, dbo.Events.title, dbo.Events.description, dbo.Events.staticURL, dbo.Events.address FROM dbo.Events"> <SelectParameters> <asp:Parameter Type="Int32" DefaultValue="1" Name="id"></asp:Parameter> </SelectParameters> </asp:SqlDataSource> <asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1" DataKeyNames="id" AllowPaging="false" Width="100%"> <ItemTemplate> <h2> <asp:Label Text='<%# Eval("title") %>' runat="server" ID="titleLabel" /> </h2> <div> <br /> <p> <asp:Label Text='<%# Eval("address") %>' runat="server" ID="addressLabel" /> </p> <p> <asp:Label Text='<%# Eval("starttime","{0:D}") %>' runat="server" ID="itemdateLabel" /> <br /> <asp:Label Text='<%# ShowDuration(Eval("starttime"),Eval("endtime")) %>' runat="server" ID="Label1" /> </p> </div> <p> <asp:Label Text='<%# Eval("description") %>' runat="server" ID="descriptionLabel" /> </p> </ItemTemplate> </asp:FormView> <div class="dashedline"> </div> </div> </div> </asp:Content> using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; using System.Configuration; using System.Data; public partial class Events_View : System.Web.UI.Page { const int INVALIDID = -1; protected void Page_Load(object sender, System.EventArgs e) { SqlDataSource1.SelectParameters["id"].DefaultValue = System.Convert.ToString(EventID); } public int EventID { get { int m_EventID; object id = ViewState["EventID"]; if (id != null) { m_EventID = (int)id; } else { id = Request.QueryString["EventID"]; if (id != null) { m_EventID = System.Convert.ToInt32(id); } else { m_EventID = 1; } ViewState["EventID"] = m_EventID; } return m_EventID; } set { ViewState["EventID"] = value; } } protected void FormView1_DataBound(object sender, System.EventArgs e) { DataRowView view = (DataRowView)(FormView1.DataItem); object o = view["staticURL"]; if (o != null && o != DBNull.Value) { string staticurl = (string)o; if (staticurl != "") { Response.Redirect(staticurl); } } } protected string ShowLocationLink(object locationname, object id) { if (id != null && id != DBNull.Value) { return "At <a href='Locations_view.aspx?LocationID=" + Convert.ToString(id) + "'>" + (string)locationname + "</a><br/>"; } else { return ""; } } protected string ShowDuration(object starttime, object endtime) { DateTime starttimeDT = (DateTime)starttime; if (endtime != null && endtime != DBNull.Value) { DateTime endtimeDT = (DateTime)endtime; if (starttimeDT.Date == endtimeDT.Date) { if (starttimeDT == endtimeDT) { return starttimeDT.ToString("h:mm tt"); } else { return starttimeDT.ToString("h:mm tt") + " - " + endtimeDT.ToString("h:mm tt"); } } else { return "thru " + endtimeDT.ToString("M/d/yy"); } } else { return starttimeDT.ToString("h:mm tt"); } } }

    Read the article

  • Check if value of textbox extended with MaskedEditExtender is valid?

    - by Ismail S
    Below is my code: <asp:TextBox ID="FromDateTextBox" runat="server" /> <asp:ImageButton ID="FromDateImageButton" runat="server" ImageUrl="~/images/calander.png" /> <ajaxkit:CalendarExtender ID="FromDate" runat="server" TargetControlID="FromDateTextBox" CssClass="CalanderControl" PopupButtonID="FromDateImageButton" Enabled="True" /> <ajaxkit:MaskedEditExtender id="FromDateMaskedEditExtender" runat="server" targetcontrolid="FromDateTextBox" Mask="99/99/9999" messagevalidatortip="true" onfocuscssclass="MaskedEditFocus" oninvalidcssclass="MaskedEditError" masktype="Date" displaymoney="Left" acceptnegative="Left" errortooltipenabled="True" /> <ajaxkit:MaskedEditValidator id="FromDateMaskedEditValidator" runat="server" controlextender="FromDateMaskedEditExtender" controltovalidate="FromDateTextBox" emptyvaluemessage="Date is required" invalidvaluemessage="Date is invalid" display="Dynamic" tooltipmessage="Input a date" emptyvalueblurredtext="*" invalidvalueblurredmessage="*" validationgroup="MKE" /> I've set Culture="auto" UICulture="auto" in @Page directive and EnableScriptGlobalization="true" EnableScriptLocalization="true" in script manager to have client culture specific date format in my textbox. I also have a Go button on my page on which I will do a partial post back. So, I want to validate the FromDateTextBox in javascript when the Go button is clicked.

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >