Search Results

Search found 294 results on 12 pages for 'cssclass'.

Page 11/12 | < Previous Page | 7 8 9 10 11 12  | Next Page >

  • asp.net CustomValidator never fires OnServerValidate

    - by Bryce Fischer
    I have the following ASP page: <asp:Content ID="Content2" ContentPlaceHolderID="ShellContent" runat="server"> <form runat="server" id="AddNewNoteForm" method="post""> <fieldset id="NoteContainer"> <legend>Add New Note</legend> <asp:ValidationSummary ID="ValidationSummary1" runat="server" /> <div class="ctrlHolder"> <asp:Label ID="LabelNoteDate" runat="server" Text="Note Date" AssociatedControlID="NoteDateTextBox"></asp:Label> <asp:TextBox ID="NoteDateTextBox" runat="server" class="textInput" CausesValidation="True" ></asp:TextBox> <asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="CustomValidator" ControlToValidate="NoteDateTextBox" OnServerValidate="CustomValidator1_ServerValidate" Display="Dynamic" >*</asp:CustomValidator> </div> <div class="ctrlHolder"> <asp:Label ID="LabelNoteText" AssociatedControlID="NoteTextTextBox" runat="server" Text="Note"></asp:Label> <asp:TextBox ID="NoteTextTextBox" runat="server" Height="102px" TextMode="MultiLine" class="textInput" ></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Note Text is Required" ControlToValidate="NoteTextTextBox">*</asp:RequiredFieldValidator> </div> <div class="buttonHolder"> <asp:Button ID="OkButton" runat="server" Text="Add New Note" CssClass="primaryAction" onclick="OkButton_Click"/> <asp:HyperLink ID="HyperLink1" runat="server">Cancel</asp:HyperLink> </div> </fieldset> </form> </asp:Content> and the following code behind for the CustomValidator1_ServerValidate() method: protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args) { if (string.IsNullOrEmpty(args.Value.Trim())) { args.IsValid = false; CustomValidator1.ErrorMessage = "Note Date is Required!"; return; } DateTime testDate; if (DateTime.TryParse(args.Value, out testDate)) { args.IsValid = true; CustomValidator1.ErrorMessage = "Invalid Date!"; } } It never seems to fail validation no matter what I put in the text box... Should mention this is ASP.NET 2.0

    Read the article

  • How to Generate Server-Side tags dynamiclly

    - by Nasser Hajloo
    I have an ASP.net page which contains some controls. I generate this controls by code, [Actually I have a method which uses a stringBuilder and add Serverside tag as flat string on it] My page shows the content correctly but unfortunately my controls became like a Client-side control For example I had a LoginView on my generated code which dosen't work, and also I had read some string from LocalResources which dosen't appear on the page What Should I do to make my generating method correct here is the code protected string CreateSubSystem(string id, string roles, string AnonymousTemplateClass, string href, string rolesContentTemplateClass, string LoggedInTemplateClass) { StringBuilder sb = new StringBuilder(); sb.Append("<div class=\"SubSystemIconPlacement\" id=\""); sb.Append(id); sb.Append("\"><asp:LoginView runat=\"server\" ID=\""); sb.Append(id); sb.Append("\"><AnonymousTemplate><div class=\""); sb.Append(AnonymousTemplateClass); sb.Append("\"></div><asp:Label ID=\"lblDisabled"); sb.Append(id); sb.Append("\" runat=\"server\" SkinID=\"OneColLabel\" meta:resourcekey=\"lbl"); sb.Append(id); sb.Append("\" /></AnonymousTemplate><RoleGroups><asp:RoleGroup Roles=\""); sb.Append(roles); sb.Append("\"><ContentTemplate><a class=\"ImageLink\" href=\""); sb.Append(href); sb.Append("\"><div class=\""); sb.Append(rolesContentTemplateClass); sb.Append("\"></div></a><asp:HyperLink runat=\"server\" CssClass=\"SubSystemText\" ID=\"lnk"); sb.Append(id); sb.Append(" NavigateUrl=\"~/"); sb.Append(href); sb.Append(" \" meta:resourcekey=\"lbl"); sb.Append(id); sb.Append("\" /></ContentTemplate></asp:RoleGroup></RoleGroups><LoggedInTemplate><div class=\""); sb.Append(LoggedInTemplateClass); sb.Append("\"></div><asp:Label runat=\"server\" SkinID=\"OneColLabel\" ID=\"lblDisabledLoggedIn"); sb.Append(id); sb.Append("\" meta:resourcekey=\"lbl"); sb.Append(id); sb.Append("\" /></LoggedInTemplate></asp:LoginView>"); sb.Append("</div>"); return sb.ToString(); } I also use this method on page_PreRender event

    Read the article

  • Problem with jQuery selector and MasterPage

    - by Daemon
    Hi, I have a problem with a master page containing a asp:textbox that I'm trying to access using jQuery. I have read lot sof thread regarding this and tried all the different approaches I have seen, but regardless, the end result end up as Undefined. This is the relevant part of the MasterPage code: <p><asp:Label ID="Label1" AssociatedControlID="osxinputfrom" runat="server">Navn</asp:Label><asp:TextBox CssClass="osxinputform" ID="osxinputfrom" runat="server"></asp:TextBox></p> When I click the button, the following code from a jQuery .js file is run: show: function(d) { $('#osx-modal-content .osxsubmitbutton').click(function (e) { e.preventDefault(); if (OSX.validate()){ $('#osx-modal-data').fadeOut(200); d.container.animate( {height:80}, 500, function () { $('#osx-modal-data').html("<h2>Sender...</h2>").fadeIn(250, function () { $.ajax({ type: "POST", url: "Default.aspx/GetDate", data: "{'from':'" + $("#osxinputfrom").val() + "','mailaddress':'" + $("#osxinputmail").val() + "','header':'Test3','message':'Test4'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { $('#osx-modal-data').fadeOut(200, function () { $('#osx-modal-data').html('<h2>Meldingen er sendt!</h2>'); $('#osx-modal-data').fadeIn(200); }); }, error: function(msg){ $('#osx-modal-data').fadeOut(200, function () { $('#osx-modal-data').html('<h2>Feil oppstod ved sending av melding!</h2>'); $('#osx-modal-data').fadeIn(200); }); } }); }); } ); } else{ $('#osxinputstatus').fadeOut(250, function () { $('#osxinputstatus').html('<p id="osxinputstatus">' + OSX.message + '</a>'); $('#osxinputstatus').fadeIn(250); }); } }); }, So the problem here is that $("#osxinputfrom").val() evaluated to Undefined. I understand that the masterpage will add some prefix to the ID, so I tried using the ID from the page when it's run that ends up as ct100_osxinputfrom, and I also tried some other hinds that I found while searching like $("#<%=osxinputfrom.ClientID%"), but it ends up as Undefined in the method that is called from the jQuery ajax method anyway. The third and fourth parameters to the ajay function that is hardcoded as Test3 and Test4 comes fine in the C# backend method. So my question is simply: How can I rewrite the jQuery selector to fetch the correct value from the textbox? (before I used master pages it worked fine by the way) Best regards Daemon

    Read the article

  • How to detect if Asp.Net form is valid

    - by Hasan Gürsoy
    Hi, I have a form which is in an updatePanel and I have a span with hidden loading image, which I want to show when user clicks to submit button but I first need to check if page is valid on client side. Also I'm making loading span visible with jQuery. Here is my code: <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> function showLoading() { $('#loader').show(); } </script> </head> <body> <asp:ScriptManager ID="smMain" runat="server"></asp:ScriptManager> <asp:UpdatePanel ID="upForm" runat="server"> <ContentTemplate> <asp:MultiView ID="mvContact" runat="server" ActiveViewIndex="0"> <asp:View ID="vDefault" runat="server"> <asp:TextBox ID="tEMail" runat="server" CssClass="input" /> <asp:RequiredFieldValidator ID="rfvEMail" runat="server" ControlToValidate="tEMail" ErrorMessage="* required" Display="Dynamic" /> <asp:RegularExpressionValidator ID="revEMail" runat="server" ControlToValidate="tEMail" ErrorMessage="* invalid" Display="Dynamic" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" /> <asp:ImageButton ID="btnSubmit" runat="server" ImageUrl="~/Assets/Images/btnSubmit.png" ToolTip="Submit Form" style="margin:5px 5px 0 -5px" onclick="btnSubmit_Click" OnClientClick="showLoading();" /> <span id="loader"><img src="Assets/Images/loader.gif" title="Sending..." /></span> </asp:View> <asp:View ID="vResult" runat="server"> <div class="result"> <span id="lResult" runat="server">Your message is sent</span> </div> </asp:View> </asp:MultiView> </ContentTemplate> </asp:UpdatePanel> </body></html>

    Read the article

  • Checkbox has the wrong values

    - by Praesagus
    I have a page with several checkboxes on it, along with a dropdownlist of users. The checkboxes correlate to the user's permissions so each user is different. When a different user is chosen, the check boxes should change to match that user's permissions. The codebehind is correct, I stepped through it and the checkbox.checked value is being assigned to the box with the correct value to match the user. chk.Checked = viewable; No matter what I assign to the checked property the value stays the same as the very first submittal. I tried chk.EnableViewState = false; but that did not help. I am sure it is dot net trying to be helpful (grrr). Thank you for your help. There is no databinding per se. I will be saving the values from the textboxes via xmlhttp when the user clicks on them. I never want the check boxes to fill with values other than what I give them. Here is the essence of the code. foreach (DataRow dRow in dTable.Rows) { viewable = Convert.ToBoolean(dRow["Viewable"]); table.Rows.Add(CreatePageRow(Convert.ToString(dRow["SitePageViewName"]), Convert.ToString(dRow["SitePageName"]), folderDepth, maxFolderDepth, viewable)); } FileTree.Controls.Add(table); private TableRow CreatePageRow(String ViewName, String FileName, Int32 folderDepth, Int32 maxFolderDepth, Boolean viewable) { TableRow tr = new TableRow(); tr.Cells.Add(CreateCheckboxCell(viewable, folderDepth+3)); tr.Cells.Add(CreateImageCell("/images/icon/sm/report_graph.gif", "Page: " + ViewName)); tr.Cells.Add(CreateTitleCell(ViewName, maxFolderDepth - (folderDepth+1), FileName)); return tr; } private TableCell CreateCheckboxCell(Boolean viewable, Int32 colSpan) { TableCell td = new TableCell(); if (colSpan > 1) td.ColumnSpan = colSpan; CheckBox chk = new CheckBox(); chk.Checked = viewable; chk.EnableViewState = false; td.Controls.Add(chk); td.CssClass = "right"; return td; }

    Read the article

  • Embedded Javascript in Master Page or Pages That Use Master Page throw "Object Expected Error"

    - by Philter
    I'm semi-new to writing ASP.Net applications using master pages and I've run into an issue I've spent some time on but can't seem to solve. My situation is that I have a master page with a structure that looks like this: <head runat="server"> <title>Test Site</title> <link rel="Stylesheet" type="text/css" href="Default.css" /> <script type="text/javascript" language="javascript" src="js/Default.js" /> <meta http-equiv="Expires" content="0"/> <meta http-equiv="Cache-Control" content="no-cache"/> <meta http-equiv="Pragma" content="no-cache"/> <asp:ContentPlaceHolder ID="cphHead" runat="server"> </asp:ContentPlaceHolder> </head> <body> <form id="form1" runat="server"> <div id="divHeader"> <asp:ContentPlaceHolder ID="cphPageTitle" runat="server"></asp:ContentPlaceHolder> </div> <div id="divMainContent"> <asp:ContentPlaceHolder ID="cphMainContent" runat="server"></asp:ContentPlaceHolder> </div> </div> </form> </body> I then have a page that uses this master page that contains the following: <asp:Content ContentPlaceHolderID="cphHead" runat="server"> <script type="text/javascript" language="javascript" > function test() { alert("Hello World"); } </script> </asp:Content> <asp:Content ContentPlaceHolderID="cphMainContent" runat="server"> <fieldset> <img alt="Select As Of Date" src="Images/Calendar.png" id="aAsOfDate" class="clickable" runat="server" onclick="test();" /> <asp:Button runat="server" CssClass="buttonStyle" ID="btnSubmit" Text="Submit" OnClick="btnSubmit_Clicked"/> </fieldset> </asp:Content> When I run this page and click on the image I get an "Object Expected" error. However, if I place the test function into my Default.js external file it will function perfectly. I can't seem to figure out why this is happening. Any ideas?

    Read the article

  • How can I include additional markup within a 'Content' inner property of an ASP.Net WebControl?

    - by GenericTypeTea
    I've searched the site and I cannot find a solution for my problem, so apologies if it's already been answered (I'm sure someone must have asked this before). I have written a jQuery Popup window that I've packaged up as a WebControl and IScriptControl. The last step is to be able to write the markup within the tags of my control. I've used the InnerProperty attribute a few times, but only for including lists of strongly typed classes. Here's my property on the WebControl: [PersistenceMode(PersistenceMode.InnerProperty)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public something??? Content { get { if (_content == null) { _content = new something???(); } return _content; } } private something??? _content; Here's the HTML Markup of what I'm after: <ctr:WebPopup runat="server" ID="win_Test" Hidden="false" Width="100px" Height="100px" Modal="true" WindowCaption="Test Window" CssClass="window"> <Content> <div style="display:none;"> <asp:Button runat="server" ID="Button1" OnClick="Button1_Click" /> </div> <%--Etc--%> <%--Etc--%> </Content> </ctr:WebPopup> Unfortunately I don't know what type my Content property should be. I basically need to replicate the UpdatePanel's ContentTemplate. EDIT: So the following allows a Template container to be automatically created, but no controls show up, what's wrong with what I'm doing? [PersistenceMode(PersistenceMode.InnerProperty)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public ITemplate Content { get { return _content; } set { _content = value; } } private ITemplate _content; EDIT2: Overriding the CreateChildControls allows the controls within the ITemplate to be rendered: protected override void CreateChildControls() { if (this.Content != null) { this.Controls.Clear(); this.Content.InstantiateIn(this); } base.CreateChildControls(); } Unfortunately I cannot now access the controls within the ITemplate from the codebehind file on the file. I.e. if I put a button within my mark as so: <ctr:WebPopup runat="server" ID="win_StatusFilter"> <Content> <asp:Button runat="server" ID="btn_Test" Text="Cannot access this from code behind?" /> </Content> </ctr:WebPopup> I then cannot access btn_Test from the code behind: protected void Page_Load(object sender, EventArgs e) { btn_Test.Text = "btn_Test is not present in Intellisense and is not accessible to the page. It does, however, render correctly."; }

    Read the article

  • asp.net menu control css for child items

    - by Andres
    I have an asp.net menu control which the child items(submenu) width is tied to its parent's width, I was wondering is there a work around? because some of the titles for the submenu are longer than the title of the parent so it looks all smooshed together and just horrible on the eyes. Any help is much appreciated. :) .net control: <asp:Menu ID="navigation" runat="server" Orientation="Horizontal" CssClass="topmenu" MaximumDynamicDisplayLevels="20" IncludeStyleBlock="false"> <DynamicSelectedStyle /> <DynamicMenuItemStyle /> <DynamicHoverStyle /> <DynamicMenuStyle /> <StaticMenuItemStyle /> <StaticSelectedStyle /> <StaticHoverStyle /> </asp:Menu> html rendered: <div class="topmenu" id="navigation"> <ul class="level1"> <li><a class="popout level1" href="dashboard.aspx?option=1">Seguridad</a> <ul class="level2"> <li><a class="level2" href="security/users.aspx?option=15">Usuarios</a></li> <li><a class="level2" href="security/profiles.aspx?option=16">Perfiles</a></li> <li><a class="level2" href="security/options.aspx?option=17">Opciones</a></li> <li><a class="level2" href="security/actions.aspx?option=18">Acciones</a></li> </ul> </li> </ul> </div> css: div.topmenu{} div.topmenu ul { list-style:none; padding:5px 0; margin:0; background: #0b2e56; } div.topmenu ul li { float:left; padding:10px; color: #fff; height:16px; z-index:9999; margin:0; } div.topmenu ul li a, div.menu ul li a:visited{ color: #fff; } div.topmenu ul li a:hover{ color:#fff; } div.topmenu ul li a:active{color:#fff; } thats what I have and the styling works i just need help in getting submenus to expand if they are bigger than main title. Thanks in advance!

    Read the article

  • ASP.NET ObjectDataSource, change CommandName property of FromView Button

    - by Tone
    I have an ObjectDataSource that I'm using with a FormView, and it works fine, but i want to change one small thing. On the FormView the button that fires the update has the CommandName attribute set to "Update," but I would like to change that attribute to something other than "Update" - when I do change that attribute the update no longer works. The reason I want to do this is I have multiple FormViews on the same page and need to have multiple update buttons. Below is my code: FormView: <asp:FormView ID="fvGeneralInfo" runat="server" DataSourceID="objInstructorDetails" CssClass="Gridview" OnItemCommand="fvGeneralInfo_ItemCommand" DefaultMode="Edit"> <EditItemTemplate> <table> .... <tr> <td style="text-align:right;"> <asp:Label runat="server" ID="lblGeneralInfoMessage" Text="General Info updated successfully" Visible="false" /> </td> <td> <asp:Button runat="server" ID="btnUpdateGeneralInfo" ValidationGroup="UpdateGeneralInfo" Text="Update" CommandName="Update" /> <asp:Button runat="server" ID="btnCancelGeneralInfo" Text="Cancel" CommandName="CancelGeneralInfo" /> </td> </tr> </table> </EditItemTemplate> </asp:FormView> ObjectDataSource: <asp:ObjectDataSource ID="objInstructorDetails" runat="server" TypeName="AIMLibrary.BLL.Instructor" SelectMethod="GetInstructorDetails" InsertMethod="InsertInstructor" UpdateMethod="UpdateInstructor" OnInserting="objInstructorDetails_OnInserting" OnUpdating="objInstructorDetails_OnUpdating" > <SelectParameters> <asp:QueryStringParameter Name="InstructorId" QueryStringField="InstructorId" /> </SelectParameters> <UpdateParameters> <asp:Parameter Name="instructorId" Type="Int32" /> <asp:Parameter Name="firstName" Type="String" DefaultValue="" /> <asp:Parameter Name="middleName" Type="String" DefaultValue="" /> <asp:Parameter Name="lastName" Type="String" DefaultValue="" /> <asp:Parameter Name="phone" Type="String" DefaultValue="" /> <asp:Parameter Name="email" Type="String" DefaultValue="" /> <asp:Parameter Name="addressLine1" Type="String" DefaultValue="" /> <asp:Parameter Name="addressLine2" Type="String" DefaultValue="" /> <asp:Parameter Name="city" Type="String" DefaultValue="" /> <asp:Parameter Name="state" Type="String" DefaultValue="" /> <asp:Parameter Name="zip" Type="String" DefaultValue="" /> <asp:Parameter Name="abcBoardNumber" Type="String" DefaultValue="" /> </UpdateParameters> </asp:ObjectDataSource>

    Read the article

  • How can I programmatically add triggers to an ASP.NET UpdatePanel?

    - by scottm
    I am trying to write a quote generator. For each product, there are a set of options. I want to dynamically add a drop down list for each option, and then have their SelectedIndexChanged events all wired up to update the quote cost. I am not having any trouble adding the DropDownList controls to my UpdatePanel, but I can't seem to wire up the events. After the page loads, the drop downs are there, with their data, but changing them does not call the SelectedIndexChanged event handler, nor does the QuoteUpdatePanel update. I have something like this: QuotePanel.ASCX <asp:ScriptManager ID="ScriptManager" runat="server" /> <asp:UpdatePanel ID="QuoteUpdatePanel" runat="server" ChildrenAsTriggers="true"> <ContentTemplate> Cost: <asp:Label ID="QuoteCostLabel" runat="server" /> <fieldset id="standard-options"> <legend>Standard Options</legend> <asp:UpdatePanel ID="StandardOptionsUpdatePanel" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional"> <ContentTemplate> </ContentTemplate> </asp:UpdatePanel> </fieldset> </ContentTemplate> </asp:UpdatePanel> The code to add the dropdowns and the event they are to be wire up for: protected void PopluateUpdatePanel(IQuoteProperty standardOptions) foreach (IQuoteProperty standardOp in standardOptions) { QuotePropertyDropDownList<IQuoteProperty> dropDownList = new QuotePropertyDropDownList<IQuoteProperty>(standardOp); dropDownList.SelectedIndexChanged += new EventHandler(QuotePropertyDropDown_SelectedIndexChanged); dropDownList.ID = standardOp.GetType().Name + "DropDownList"; ScriptManager.RegisterAsyncPostBackControl(dropDownList); Label propertyLabel = new Label() {Text = standardOp.Title, CssClass = "quote-property-label"}; this.StandardOptionsUpdatePanel.ContentTemplateContainer.Controls.Add(propertyLabel); this.StandardOptionsUpdatePanel.ContentTemplateContainer.Controls.Add(dropDownList); _standardOptionsListBoxes.Add(dropDownList); AsyncPostBackTrigger trigger = new AsyncPostBackTrigger() { ControlID = dropDownList.UniqueID, EventName = "SelectedIndexChanged" }; this.StandardOptionsUpdatePanel.Triggers.Add(trigger); } } void QuotePropertyDropDown_SelectedIndexChanged(object sender, EventArgs e) { QuoteCostLabel.Text = QuoteCost.ToString(); }

    Read the article

  • C#: Label contains no text

    - by Vinzcent
    Hey I would like to get the text out of a label. But the label text is set with Javascript. On the page I can see that there is text in the label, but when I debug it shows this: "". So how do I get the text out of a label that is set with Javascript, at least that is what I think is the problem. My code: <asp:TextBox ID="txtCount" runat="server" Width="50px" Font-Names="Georgia, Arial, sans-Serif" ForeColor="#444444"></asp:TextBox> <ajaxToolkit:NumericUpDownExtender ID="NumericUpDownExtender1" runat="server" Minimum="1" TargetButtonDownID="btnDown" TargetButtonUpID="btnUp" TargetControlID="txtCount" Width="20" /> <asp:ImageButton ID="btnUp" runat="server" AlternateText="up" ImageUrl="Images/arrowUp.png" OnClientClick="setAmountUp()" ImageAlign="Top" CausesValidation="False" /> <asp:ImageButton ID="btnDown" runat="server" AlternateText="down" ImageUrl="Images/arrowDown.png" OnClientClick="setAmountDown()" ImageAlign="Bottom" CausesValidation="False" /> <asp:Label ID="lblKorting" runat="server" /> <asp:Label ID="lblAmount" runat="server" /> <asp:Button ID="btnBestel" runat="server" CssClass="btn" Text="Bestel" OnClick="btnBestel_Click1" /> JS function setAmountUp() { var aantal = document.getElementById('<%=txtCount.ClientID%>').value-0; aantal+=1; calculateAmount(aantal); } function setAmountDown() { var aantal = document.getElementById('<%=txtCount.ClientID%>').value-0; if(aantal > 1) aantal -=1; calculateAmount(aantal); } function calculateAmount(aantal) { var prijs = document.getElementById('<%=lblPriceBestel.ClientID%>').innerHTML -0; var totaal = 0; if(aantal < 2) { totaal = prijs * aantal; document.getElementById('<%=lblKorting.ClientID%>').innerHTML = ""; } else if(aantal >= 2 && aantal < 5) { totaal = (prijs * aantal)*0.95; document.getElementById('<%=lblKorting.ClientID%>').innerHTML = "-5%"; } else if(aantal >= 5) { totaal = (prijs * aantal)*0.90; document.getElementById('<%=lblKorting.ClientID%>').innerHTML = "-10%"; } document.getElementById('<%=lblAmount.ClientID%>').innerHTML = totaal; } C# private OrderBO bestelling; protected void btnBestel_Click1(object sender, EventArgs e) { bestelling = new OrderBO(); bestelling.Amount = Convert.ToInt32(lblAmount.Text); //<--- THIS IS "" in the debugger, but on the page 10 }

    Read the article

  • Get Confirm value in vb.net

    - by user1805641
    I have a hidden asp Button in a Repeater. In the VB.NET code behind I use the Rerpeater_ItemCommand to get the click event within the Repeater. There's a check if user is already recording a project. If yes and he wants to start a new one, a confirm box should appear asking "Are you sure?" How can I access the click value from confirm? <asp:Repeater ID="Repeater1" runat="server" OnItemCommand="Repeater1_ItemCommand"> <ItemTemplate> <div class="tile user_view user_<%# Eval("employeeName") %>"> <div class="tilesheight"></div> <div class="element"> <asp:Button ID="Button1" CssClass="hiddenbutton" runat="server" /> Index: <asp:Label ID="Label1" runat="server" Text='<%# Eval("index") %>' /><br /> <hr class="hr" /> customer: <asp:Label ID="CustomerLabel" runat="server" Text='<%# Eval("customer") %>' /><br /> <hr class ="hr" /> order: <asp:Label ID="OrderNoLabel" runat="server" Text='<%# Eval("orderNo") %>' /><br /> <asp:Label ID="DescriptionLabel" runat="server" Text='<%# Eval("description") %>' /><br /> <hr class="hr" /> </div> </div> </ItemTemplate> </asp:Repeater> code behind: If empRecs.Contains(projects.Item(index.Text).employeeID) Then 'Catch index of recording order i = empRecs.IndexOf(projects.Item(index.Text).employeeID) Page.ClientScript.RegisterStartupScript(Me.GetType, "confirm", "confirm('Order " & empRecs(i + 2) & " already recording. Would you like to start a new one?')",True) 'If users clicks ok insertData() End If Other solutions are using the Click Event and a hidden field. But the problem is, I don't want the confirmbox to appear every time the button is clicked. Only when empRecs conatins an employee. Thanks for helping

    Read the article

  • How does Page.IsValid work?

    - by Lijo
    I have following code with a RequiredFieldValidator. The EnableClientScript property is set as "false" in the validation control. Also I have disabled script in browser. I am NOT using Page.IsValid in code behind. Still, when I submit without any value in textbox I will get error message. From comments of @Dai, I came to know that this can be an issue, if there is any code in Page_Load that is executed in a postback. There will be no validation errors thrown. (However, for button click handler, there is no need to check Page.IsValid) if (Page.IsPostBack) { string value = txtEmpName.Text; txtEmpName.Text = value + "Appended"; } QUESTION Why the server side validation does not happen before Page_Load? Why it works fine when I use Page.IsValid? UPDATE It seems like, we need to add If(Page.IsValid) in button click also if we are using a Custom Validator with server side validation. Refer CustomValidator not working well. Note: Client side validation question is present here: Whether to use Page_IsValid or Page_ClientValidate() (for Client Side Events) MARKUP <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script type="text/javascript"> alert('haiii'); </script> </head> <body> <form id="form1" runat="server"> <div> <asp:ValidationSummary runat="server" ID="vsumAll" DisplayMode="BulletList" CssClass="validationsummary" ValidationGroup="ButtonClick" /> <asp:TextBox ID="txtEmpName" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="valEmpName" runat="server" ControlToValidate="txtEmpName" EnableClientScript="false" ErrorMessage="RequiredFieldValidator" Text="*" Display="Dynamic" ValidationGroup="ButtonClick"></asp:RequiredFieldValidator> <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" ValidationGroup="ButtonClick" /> </div> </form> </body> </html> CODE BEHIND protected void Button1_Click(object sender, EventArgs e) { string value = txtEmpName.Text; SubmitEmployee(value); } References: Should I always call Page.IsValid? ASP.NET Validation Controls – Important Points, Tips and Tricks CustomValidator not working well

    Read the article

  • jQuery replacing an image inside a .net datalist

    - by user359409
    (submit said I was trying to post an image so I've changed image everywhere to ix I am trying to get jQuery to replace an ix inside a datalist. The original ix is the thumbnail ix of a product on a category page. The small ix I am clicking on are swatch ix for the different colors of a product. I can get it to work using a div tag around the ix tag inside the ItemTemplate. I don't need to use a div tag if I can get the imagesx to swap- I was just using it because that is sample code I found and it works for the first product in the category. <asp:HyperLink ID="ProductNav" runat="server" NavigateUrl='<%#Eval("NavigateUrl") %>'> <div id="ladiv" runat="server"> <asp:Ixx runat="server" ID="ProdThumb" /> </div> </asp:HyperLink> <asp:PlaceHolder ID="phSwatches" runat="server"></asp:PlaceHolder> The ProdThumb ix is added from the code behind and the swatches are added from the code behind swatches.Controls.Add(new LiteralControl("<table><tr>")); foreach(OptionChoice optionChoice in option.Choices) { string swatchThumbnail = string.Format("<ix ID=\"{0}\" src=\"{1}\" border=\"0\" class=\"{2}\" />","swatch" + optionChoice.OptionChoiceId.ToString(), ResolveUrl(optionChoice.ThumbnailUrl),"imgthumb"); swatches.Controls.Add(new LiteralControl("<td>")); swatches.Controls.Add(new LiteralControl(swatchThumbnail)); swatches.Controls.Add(new LiteralControl("</td>")); } swatches.Controls.Add(new LiteralControl("</tr></table>")); prodThumb.IxUrl = product.ThumbnailUrl; prodThumb.AlternateText = product.ThumbnailAltText; prodThumb.CssClass = "Thumbnail"; The jQuery is: $(function() { $("ix.imgthumb").click(function(e) { var t = $(this); var newImg = ''; $('#ladiv') .html($(newImg) ); }); }); </script> Both images are named similar, except the swatch contains "sws" and the larger one is the some only with "swl". I have spent several days searching but am not able to get it to work. If I try something like $("#<%=ladiv.ClientID %") the code can't find it. I appreciate any help.

    Read the article

  • Accesing server control from withing app_code class

    - by OverSeven
    My question is about how to acces a server control (listbox) that is located in default.aspx. I wish to acces this control in Functions.cs (this class is located in the App_Code folder). My page structures: - 1 masterpage with 1 content holder - Default.aspx (all the controls are within the content place holder) - Functions.cs (located in App_Code) Now when i try to fill up the listbox elements i get the error "object reference not set to an instance of an object." What i have tried to gain acces to this control: (this code is located in Functions.cs in App_Code). This is basicly showing some items in the listbox that are located in the xml file private static string file = HttpContext.Current.Server.MapPath("~/App_Data/Questions.xml"); public static void ListItems() { XmlDocument XMLDoc = new XmlDocument(); XMLDoc.Load(file); XPathNavigator nav = XMLDoc.CreateNavigator(); XPathExpression expr; expr = nav.Compile("/root/file/naam"); XPathNodeIterator iterator = nav.Select(expr); //ATTEMPT to get acces to ServerControl(listbox) Page page = (Page)HttpContext.Current.Handler; ListBox test = (ListBox)page.FindControl("lbTest"); //control is called lbTest in Default.aspx test.Items.Clear(); while (iterator.MoveNext()) { test.Items.Add(iterator.Current.Value); } } Code from the default.apx file <%@ Page Title="" Language="C#" MasterPageFile="~/MasterFile.master" AutoEventWireup="true" CodeFile="default.aspx.cs" Inherits="default" Debug="true" %> <%@ MasterType TypeName="Master" %> <asp:Content ID="Content1" ContentPlaceHolderID="cphContent" Runat="Server" > <asp:MultiView ID="mvTest" runat="server" > <asp:View ID="vCollection" runat="server"> <asp:ListBox ID="lbTest" runat="server" CssClass="listbox" ></asp:ListBox> </asp:View> </asp:MultiView> </asp:Content> The masterfile itself just has 1 placeholder. Then i call upon the funcion ListItems in the Default.aspx.cs file protected void Page_Load(object sender, EventArgs e) { Functions.ListItems(); } Regards.

    Read the article

  • How to add a title attribute to every option of an ASP.NET DropDownList

    - by zuallauz
    I'm working on an older ASP.NET project (not MVC I don't think) and one of the features they require is to view a description of an item when they hover over that item in a dropdown list. This can be simply done with HTML using the following code and making use of title text: <select> <option value="1" title="Option 1 Desc">Option 1</option> <option value="2" title="Option 2 Desc">Option 2</option> <option value="3" title="Option 3 Desc">Option 3</option> </select> Ok so how do I do this using ASP.NET DropDownList control? I have the following code: <asp:DropDownList ID="DropDownListLocation" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DropDownListLocation_OnSelectedIndexChanged" CssClass="editorFieldServerControl" ClientIDMode="Static"></asp:DropDownList> And in the 'code behind' page: private void PopulateFacilityDropdown(List<FacilityAvailableByLocation> facilities, int? selectedID) { DropDownListFacility.DataSource = facilities; DropDownListFacility.DataTextField = "FacilityName"; DropDownListFacility.DataValueField = "FacilityID"; DropDownListFacility.DataBind(); DropDownListFacility.Items.Insert(0, new System.Web.UI.WebControls.ListItem("", "")); if (selectedID.HasValue && selectedID.Value > 0) DropDownListFacility.SelectedIndex = facilities.FindIndex(b => b.FacilityID == selectedID.Value); else DropDownListFacility.SelectedIndex = 0; } } Basically each facility in the list of facilities there has properties for an ID, Name, Description that I can get out. I just want to be able to put a title attribute on each <option> that gets rendered and put the description into it. Either that or be able to add a custom attribute like 'data-description' to each <option> tag then I can add the title into each option tag myself using a bit of jQuery which is easy enough. I miss the days where you could just loop through a list and output the custom dropdown code manually. Any ideas? Many thanks

    Read the article

  • How to bind a label inside a gridview to another table?

    - by Kolten
    I have a very standard Gridview, with Edit and Delete buttons auto-generated. It is bound to a tableadapter which is linked to my "RelationshipTypes" table. dbo.RelationshipTypes: ID, Name, OriginConfigTypeID, DestinationConfigTypeID I wish to use a label that will pull the name from the ConfigTypes table, using the "OriginConfigTypeID" and "DestinationTypeID" as the link. dbo.ConfigTypes: ID, Name My problem is, I can't automatically generate Edit and Delete buttons using an Inner Join in my dataset. Or can I? FOllowing is my code: <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" AutoGenerateDeleteButton="True" AutoGenerateEditButton="True" CssClass="TableList" DataKeyNames="ID" DataSourceID="dsRelationShipTypes1"> <Columns> <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" Visible=False/> <asp:TemplateField HeaderText="Origin" SortExpression="OriginCIType_ID"> <EditItemTemplate> &nbsp;<asp:DropDownList Enabled=true ID="DropDownList2" runat="server" DataSourceID="dsCIType1" DataTextField="Name" DataValueField="ID" SelectedValue='<%# Bind("OriginCIType_ID") %>'> </asp:DropDownList> </EditItemTemplate> <ItemTemplate> &nbsp; <asp:Label ID="Label2" runat="server" Text='<%# Bind("OriginCIType_ID") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Name" SortExpression="Name"> <EditItemTemplate> <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label3" runat="server" Text='<%# Bind("Name") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Destination" SortExpression="DestinationCIType_ID"> <EditItemTemplate> <asp:DropDownList ID="DropDownList3" runat="server" DataSourceID="dsCIType1" DataTextField="Name" DataValueField="ID" SelectedValue='<%# Bind("DestinationCIType_ID") %>'> </asp:DropDownList> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Bind("DestinationCIType_ID") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> So I did try to create my own edit and delete buttons, but kept receiving the error "cannot find update method" or something similar. Do I have to manually code the delete and update methods in my code-behind?

    Read the article

  • On asp:Table Control how do we create a thead ?

    - by balexandre
    from MSDN article on the subject we can see that we create a TableHeaderRowthat conatins TableHeaderCells. but they add the table header like this: myTable.Row.AddAt(0, headerRow); witch outputs the HTML: <table id="Table1" ... > <tr> <th scope="column" abbr="Col 1 Head">Column 1 Header</th> <th scope="column" abbr="Col 2 Head">Column 2 Header</th> <th scope="column" abbr="Col 3 Head">Column 3 Header</th> </tr> <tr> <td>(0,0)</td> <td>(0,1)</td> <td>(0,2)</td> </tr> ... and it should have <thead> and <tbody> (so it works seamless with tablesorter) :) <table id="Table1" ... > <thead> <tr> <th scope="column" abbr="Col 1 Head">Column 1 Header</th> <th scope="column" abbr="Col 2 Head">Column 2 Header</th> <th scope="column" abbr="Col 3 Head">Column 3 Header</th> </tr> </thead> <tbody> <tr> <td>(0,0)</td> <td>(0,1)</td> <td>(0,2)</td> </tr> ... </tbody> the HTML aspx code is <asp:Table ID="Table1" runat="server" /> How can I output the correct syntax? Just as information, the GridViewcontrol has this builed in as we just need to set teh Accesbility and use the HeaderRow gv.UseAccessibleHeader = true; gv.HeaderRow.TableSection = TableRowSection.TableHeader; gv.HeaderRow.CssClass = "myclass"; but the question is for the Table control.

    Read the article

  • ASP.NET Controls – CommunityServer Captcha ControlAdapter, a practical case

    - by nmgomes
    The ControlAdapter is available since .NET framework version 2.0 and his main goal is to adapt and customize a control render in order to achieve a specific behavior or layout. This customization is done without changing the base control. A ControlAdapter is commonly used to custom render for specific platforms like Mobile. In this particular case the ControlAdapter was used to add a specific behavior to a Control. In this  post I will use one adapter to add a Captcha to all WeblogPostCommentForm controls within pontonetpt.com CommunityServer instance. The Challenge The ControlAdapter complexity is usually associated with the complexity/structure of is base control. This case is precisely one of those since base control dynamically load his content (controls) thru several ITemplate. Those of you who already played with ITemplate knows that while it is an excellent option for control composition it also brings to the table a big issue: “Controls defined within a template are not available for manipulation until they are instantiated inside another control.” While analyzing the WeblogPostCommentForm control I found that he uses the ITemplate technique to compose it’s layout and unfortunately I also found that the template content vary from theme to theme. This could have been a problem but luckily WeblogPostCommentForm control template content always contains a submit button with a well known ID (at least I can assume that there are a well known set of IDs). Using this submit button as anchor it’s possible to add the Captcha controls in the correct place. Another important finding was that WeblogPostCommentForm control inherits from the WrappedFormBase control which is the base control for all CommunityServer input forms. Knowing this inheritance link the main goal has changed to became the creation of a base ControlAdapter that  could be extended and customized to allow adding Captcha to: post comments form contact form user creation form. And, with this mind set, I decided to used the following ControlAdapter base class signature :public abstract class WrappedFormBaseCaptchaAdapter<T> : ControlAdapter where T : WrappedFormBase { }Great, but there are still many to do … Captcha The Captcha will be assembled with: A dynamically generated image with a set of random numbers A TextBox control where the image number will be inserted A Validator control to validate whether TextBox numbers match the image numbers This is a common Captcha implementation, is not rocket science and don’t bring any additional problem. The main problem, as told before, is to find the correct anchor control to ensure a correct Captcha control injection. The anchor control can vary by: target control  theme Implementation To support this dynamic scenario I choose to use the following implementation:private List<string> _validAnchorIds = null; protected virtual List<string> ValidAnchorIds { get { if (this._validAnchorIds == null) { this._validAnchorIds = new List<string>(); this._validAnchorIds.Add("btnSubmit"); } return this._validAnchorIds; } } private Control GetAnchorControl(T wrapper) { if (this.ValidAnchorIds == null || this.ValidAnchorIds.Count == 0) { throw new ArgumentException("Cannot be null or empty", "validAnchorNames"); } var q = from anchorId in this.ValidAnchorIds let anchorControl = CSControlUtility.Instance().FindControl(wrapper, anchorId) where anchorControl != null select anchorControl; return q.FirstOrDefault(); } I can now, using the ValidAnchorIds property, configure a set of valid anchor control  Ids. The GetAnchorControl method searches for a valid anchor control within the set of valid control Ids. Here, some of you may question why to use a LINQ To Objects expression, but the important here is to notice the usage of CSControlUtility.Instance().FindControl CommunityServer method. I want to build on top of CommunityServer not to reinvent the wheel. Assuming that an anchor control was found, it’s now possible to inject the Captcha at the correct place. This not something new, we do this all the time when creating server controls or adding dynamic controls:protected sealed override void CreateChildControls() { base.CreateChildControls(); if (this.IsCaptchaRequired) { T wrapper = base.Control as T; if (wrapper != null) { Control anchorControl = GetAnchorControl(wrapper); if (anchorControl != null) { Panel phCaptcha = new Panel {CssClass = "CommonFormField", ID = "Captcha"}; int index = anchorControl.Parent.Controls.IndexOf(anchorControl); anchorControl.Parent.Controls.AddAt(index, phCaptcha); CaptchaConfiguration.DefaultProvider.AddCaptchaControls( phCaptcha, GetValidationGroup(wrapper, anchorControl)); } } } } Here you can see a new entity in action: a provider. This is a CaptchaProvider class instance and is only goal is to create the Captcha itself and do everything else is needed to ensure is correct operation.public abstract class CaptchaProvider : ProviderBase { public abstract void AddCaptchaControls(Panel captchaPanel, string validationGroup); } You can create your own specific CaptchaProvider class to use different Captcha strategies including the use of existing Captcha services  like ReCaptcha. Once the generic ControlAdapter was created became extremely easy to created a specific one. Here is the specific ControlAdapter for the WeblogPostCommentForm control:public class WeblogPostCommentFormCaptchaAdapter : WrappedFormBaseCaptchaAdapter<WrappedFormBase> { #region Overriden Methods protected override List<string> ValidAnchorIds { get { List<string> validAnchorNames = base.ValidAnchorIds; validAnchorNames.Add("CommentSubmit"); return validAnchorNames; } } protected override string DefaultValidationGroup { get { return "CreateCommentForm"; } } #endregion Overriden Methods } Configuration This is the magic step. Without changing the original pages and keeping the application original assemblies untouched we are going to add a new behavior to the CommunityServer application. To glue everything together you must follow this steps: Add the following configuration to default.browser file:<?xml version='1.0' encoding='utf-8'?> <browsers> <browser refID="Default"> <controlAdapters> <!-- Adapter for the WeblogPostCommentForm control in order to add the Captcha and prevent SPAM comments --> <adapter controlType="CommunityServer.Blogs.Controls.WeblogPostCommentForm" adapterType="NunoGomes.CommunityServer.Components.WeblogPostCommentFormCaptchaAdapter, NunoGomes.CommunityServer" /> </controlAdapters> </browser> </browsers> Add the following configuration to web.config file:<configuration> <configSections> <!-- New section for Captcha providers configuration --> <section name="communityServer.Captcha" type="NunoGomes.CommunityServer.Captcha.Configuration.CaptchaSection" /> </configSections> <!-- Configuring a simple Captcha provider --> <communityServer.Captcha defaultProvider="simpleCaptcha"> <providers> <add name="simpleCaptcha" type="NunoGomes.CommunityServer.Captcha.Providers.SimpleCaptchaProvider, NunoGomes.CommunityServer" imageUrl="~/captcha.ashx" enabled="true" passPhrase="_YourPassPhrase_" saltValue="_YourSaltValue_" hashAlgorithm="SHA1" passwordIterations="3" keySize="256" initVector="_YourInitVectorWithExactly_16_Bytes_" /> </providers> </communityServer.Captcha> <system.web> <httpHandlers> <!-- The Captcha Image handler used by the simple Captcha provider --> <add verb="GET" path="captcha.ashx" type="NunoGomes.CommunityServer.Captcha.Providers.SimpleCaptchaProviderImageHandler, NunoGomes.CommunityServer" /> </httpHandlers> </system.web> <system.webServer> <handlers accessPolicy="Read, Write, Script, Execute"> <!-- The Captcha Image handler used by the simple Captcha provider --> <add verb="GET" name="captcha" path="captcha.ashx" type="NunoGomes.CommunityServer.Captcha.Providers.SimpleCaptchaProviderImageHandler, NunoGomes.CommunityServer" /> </handlers> </system.webServer> </configuration> Conclusion Building a ControlAdapter can be complex but the reward is his ability to allows us, thru configuration changes, to modify an application render and/or behavior. You can see this ControlAdapter in action here and here (anonymous required). A complete solution is available in “CommunityServer Extensions” Codeplex project.

    Read the article

  • Adding proper THEAD sections to a GridView

    - by Rick Strahl
    I’m working on some legacy code for a customer today and dealing with a page that has my favorite ‘friend’ on it: A GridView control. The ASP.NET GridView control (and also the older DataGrid control) creates some pretty messed up HTML. One of the more annoying things it does is to generate all rows including the header into the page in the <tbody> section of the document rather than in a properly separated <thead> section. Here’s is typical GridView generated HTML output: <table class="tablesorter blackborder" cellspacing="0" rules="all" border="1" id="Table1" style="border-collapse:collapse;"> <tr> <th scope="col">Name</th> <th scope="col">Company</th> <th scope="col">Entered</th><th scope="col">Balance</th> </tr> <tr> <td>Frank Hobson</td><td>Hobson Inc.</td> <td>10/20/2010 12:00:00 AM</td><td>240.00</td> </tr> ... </table> Notice that all content – both the headers and the body of the table – are generated directly under the <table> tag and there’s no explicit use of <tbody> or <thead> (or <tfooter> for that matter). When the browser renders this the document some default settings kick in and the DOM tree turns into something like this: <table> <tbody> <tr> <-- header <tr> <—detail row <tr> <—detail row </tbody> </table> Now if you’re just rendering the Grid server side and you’re applying all your styles through CssClass assignments this isn’t much of a problem. However, if you want to style your grid more generically using hierarchical CSS selectors it gets a lot more tricky to format tables that don’t properly delineate headers and body content. Also many plug-ins and other JavaScript utilities that work on tables require a properly formed table layout, and many of these simple won’t work out of the box with a GridView. For example, one of the things I wanted to do for this app is use the jQuery TableSorter plug-in which – not surprisingly – requires to work of table headers in the DOM document. Out of the box, the TableSorter plug-in doesn’t work with GridView controls, because the lack of a <thead> section to work on. Luckily with a little help of some jQuery scripting there’s a real easy fix to this problem. Basically, if we know the GridView generated table has a header in it, code like the following will move the headers from <tbody> to <thead>: <script type="text/javascript"> $(document).ready(function () { // Fix up GridView to support THEAD tags $("#gvCustomers tbody").before("<thead><tr></tr></thead>"); $("#gvCustomers thead tr").append($("#gvCustomers th")); $("#gvCustomers tbody tr:first").remove(); $("#gvCustomers").tablesorter({ sortList: [[1, 0]] }); }); </script> And voila you have a table that now works with the TableSorter plug-in. If you use GridView’s a lot you might want something a little more generic so the following does the same thing but should work more generically on any GridView/DataGrid missing its <thead> tag: function fixGridView(tableEl) {            var jTbl = $(tableEl);         if(jTbl.find("tbody>tr>th").length > 0) {         jTbl.find("tbody").before("<thead><tr></tr></thead>");         jTbl.find("thead tr").append(jTbl.find("th"));         jTbl.find("tbody tr:first").remove();     } } which you can call like this: $(document).ready(function () { fixGridView( $("#gvCustomers") ); $("#gvCustomers").tablesorter({ sortList: [[1, 0]] }); }); Server Side THEAD Rendering [updated from comments 11/21/2010] Several commenters pointed out that you can also do this on the server side by using the GridView.HeaderRow.TableSection property to force rendering with a proper table header. I was unaware of this option actually – not exactly an easy one to discover. One issue here is that timing of this needs to happen during the databinding process so you need to use an event handler: this.gvCustomers.DataBound += (object o, EventArgs ev) => { gvCustomers.HeaderRow.TableSection = TableRowSection.TableHeader; }; this.gvCustomers.DataSource = custList; this.gvCustomers.DataBind(); You can apply the same logic for the FooterRow. It’s beyond me why this rendering mode isn’t the default for a GridView – why would you ever want to have a table that doesn’t use a THEAD section??? But I disgress :-) I don’t use GridViews much anymore – opting for more flexible approaches using ListViews or even plain code based views or other custom displays that allow more control over layout, but I still see a lot of old code that does use them old clunkers including my own :) (gulp) and this does make life a little bit easier especially if you’re working with any of the jQuery table related plug-ins that expect a proper table structure.© Rick Strahl, West Wind Technologies, 2005-2010Posted in ASP.NET  jQuery  

    Read the article

  • #include file vs iframe or is there a better way

    - by Laurence Burke
    ok simple question about including large mostly static html and asp.net code I am using as of right now #include and I was wondering if iframes would be a better way of handling what I wish to do or is there a better way to do it. here is the current way i'm handling the includes default.aspx <head id="YafHead" runat="server"> <meta id="YafMetaDescription" runat="server" name="description" content="Yet Another Forum.NET -- A bulletin board system written in ASP.NET" /> <meta id="YafMetaKeywords" runat="server" name="keywords" content="Yet Another Forum.net, Forum, ASP.NET, BB, Bulletin Board, opensource" /> <title>Forums</title> <style type="text/css"> .sbutton { background-color:#361800; border:medium none; border-collapse:collapse; color:#FFFFFF; font-family:Tahoma,Arial,Helvetica; font-size:10px; font-weight:bold; vertical-align:middle; } </style> <link href="images/favicon.ico" type="image/ico" rel="shortcut icon" /> <link rel="stylesheet" href="navTopStyle.css" type="text/css" media="screen" /> </head> <body style="margin: 0"> <form id="form1" runat="server" enctype="multipart/form-data"> <table align="center" style="background-color: #ffffff" cellpadding="0" cellspacing="0" width="790px"> <tr> <td> <!--#include file="CComHeader.html"--> </td> </tr> <tr> <td> <YAF:Forum runat="server" ID="forum"></YAF:Forum> </td> </tr> </table> </form> </body> </html> CComHeader.html <table cellpadding="0" cellspacing="0" width="790px"> <tr> <td align="left"> <img src="images/smokechair.jpg" alt="Cigar.com" /><img src="images/cigarcomTitle.gif" alt="Cigar.com" /> </td> <td align="right"> <table width="310px" height="73px" cellpadding="0" cellspacing="0" style="padding-right: 6px"> <tr> <td width="109px" class="welcome" align="left"> Welcome to Cigar.com </td> <td width="195px" class="welcome" align="left"> <div runat="server" id="divUser"> <table cellpadding="0" cellspacing="0" align="right"> <tr> <td width="126px" align="left"> <asp:Label ID="lblUserName" CssClass="welcome" runat="server"></asp:Label></td> <td width="65px" align="left"> <a href="http://www.cigar.com/cs/languages/en-US/docs/faq.aspx">Help</a></td> </tr> </table> </div> <div runat="server" id="divGuest"> <a href="OutsideLogin.aspx">Sign In</a> | <a href="OutsideLogin.aspx">Join</a> | <a href="http://www.cigar.com/cs/languages/en-US/docs/faq.aspx">Help</a> </div> </td> </tr> <tr> <td colspan="2"> <table cellpadding="0" cellspacing="0" > <tr> <td width="234px" align="right"> <asp:DropDownList ID="ddlCriteria" runat="server"> <asp:ListItem>Posts</asp:ListItem> <asp:ListItem>Posted By</asp:ListItem> </asp:DropDownList> <asp:TextBox Width="120px" ID="txtSearch" runat="server"></asp:TextBox> </td> <td width="70px" align="center"> <asp:Button ID="btnSearch" runat="server" Text="Search" CssClass="sbutton" OnClick="btnSearch_Click" /> </td> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td colspan="2"> <!--#include file="commonTabBar.html" --> </td> </tr> </table> commonTabBar.html <%-- CommonTabBar firebugged from Cigar.com--%> <div class="CommonTabBar"> <script language="javascript"> function tabOver(e) { if (e.className != 'CommonSimpleTabStripSelectedTab') e.className = 'CommonSimpleTabStripTabHover'; } function tabOut(e) { if (e.className != 'CommonSimpleTabStripSelectedTab') e.className = 'CommonSimpleTabStripTab'; } function tabOverSub(e) { if (e.className != 'CommonSimpleTabStripSelectedTabSub') e.className = 'CommonSimpleTabStripTabHoverSub'; } function tabOutSub(e) { if (e.className != 'CommonSimpleTabStripSelectedTabSub') e.className = 'CommonSimpleTabStripTabSub'; } </script> <table border="0" cellpadding="0" cellspacing="0"> <tbody> <tr valign="middle"> <td class="CommonSimpleTabStripTab" style="padding: 0px"> &nbsp; </td> <td class="CommonSimpleTabStripTab" onmouseover="tabOver(this);" onmouseout="tabOut(this);" onclick="window.location = 'http://www.cigar.com/index.asp'"> <a style="float: right; display: block; height: 30px; line-height: 30px; padding-left: 12px; padding-right: 12px; vertical-align: middle;" href="http://www.cigar.com/index.asp"> Home</a> </td> <td class="CommonSimpleTabStripTab" onmouseover="tabOver(this); document.getElementById('ComDropDown2').style.display = 'inline';" onmouseout="tabOut(this); document.getElementById('ComDropDown2').style.display = 'none';"> <a style="float: right; display: block; height: 30px; line-height: 30px; padding-left: 12px; padding-right: 12px; vertical-align: middle;" href="http://www.cigar.com/cigars/index.asp"> Cigars</a> <div id="ComDropDown2" style="border: 1px solid rgb(71, 42, 24); margin: 28px 0px 0px; display: none; background-color: rgb(235, 230, 208); color: rgb(71, 42, 24); position: absolute; float: left; z-index: 200;" onmouseover="document.getElementById('ComDropDown2').style.display = 'inline';" onmouseout="document.getElementById('ComDropDown2').style.display = 'none';"> <ul style="margin: 0px; padding: 0px; width: 100px;"> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/cigars/index.asp'"><a href="http://www.cigar.com/cigars/index.asp" style="line-height: 25px; color: rgb(71, 42, 24);" id="BrandsLink">Brands </a> </li> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/cigars/privatelabel.asp?brand=419'"> <a href="http://www.cigar.com/cigars/privatelabel.asp?brand=419" style="line-height: 25px; color: rgb(71, 42, 24);" id="SamplersLink">Aging Room </a></li> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/cigars/samplers.asp'"><a href="http://www.cigar.com/cigars/samplers.asp" style="line-height: 25px; color: rgb(71, 42, 24);" id="SamplersLink">Samplers </a></li> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/cigars/suggestions.asp'"><a href="http://www.cigar.com/cigars/suggestions.asp" style="line-height: 25px; color: rgb(71, 42, 24);" id="SuggestionsLink">Suggestions </a></li> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/DailyDeal/ccCigarDeals.asp'"><a href="http://www.cigar.com/DailyDeal/ccCigarDeals.asp" style="line-height: 25px; color: rgb(71, 42, 24);" id="SuggestionsLink">Suggestions </a></li> </ul> </div> </td> <td class="CommonSimpleTabStripTab" onmouseover="tabOver(this); document.getElementById('ComDropDown3').style.display = 'inline';" onmouseout="tabOut(this); document.getElementById('ComDropDown3').style.display = 'none';"> <a style="float: right; display: block; height: 30px; line-height: 30px; padding-left: 12px; padding-right: 12px; vertical-align: middle;" href="http://www.cigar.com/cigars/samplers.asp"> Samplers</a> <div id="ComDropDown3" style="border: 1px solid rgb(71, 42, 24); margin: 28px 0px 0px; display: none; background-color: rgb(235, 230, 208); color: rgb(71, 42, 24); position: absolute; float: left; z-index: 200;" onmouseover="document.getElementById('ComDropDown3').style.display = 'inline';" onmouseout="document.getElementById('ComDropDown3').style.display = 'none';"> <ul style="margin: 0px; padding: 0px; width: 100px;"> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/cigars/viewsamplers.asp?subcatid=samp_var'"> <a href="http://www.cigar.com/cigars/viewsamplers.asp?subcatid=samp_var" style="line-height: 25px; color: rgb(71, 42, 24);" id="Variety SamplersLink">Variety Samplers </a> </li> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/cigars/viewsamplers.asp?subcatid=gift_samp'"> <a href="http://www.cigar.com/cigars/viewsamplers.asp?subcatid=gift_samp" style="line-height: 25px; color: rgb(71, 42, 24);" id="Gift SamplersLink">Gift Samplers </a></li> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/cigars/createSampler.asp'"><a href="http://www.cigar.com/cigars/createSampler.asp" style="line-height: 25px; color: rgb(71, 42, 24);" id="Custom SamplerLink">Custom Sampler </a></li> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/cigars/viewsamplers.asp?subcatid=Feat%20Samp'"> <a href="http://www.cigar.com/cigars/viewsamplers.asp?subcatid=Feat%20Samp" style="line-height: 25px; color: rgb(71, 42, 24);" id="Featured SamplersLink">Featured Samplers </a> </li> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/cigars/YouPickOffer.asp'"><a href="http://www.cigar.com/cigars/YouPickOffer.asp" style="line-height: 25px; color: rgb(71, 42, 24);" id="Brand SamplersLink">U Pick 2 Offer </a></li> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/cigars/exclusiveCustomSampler.asp'"> <a href="http://www.cigar.com/cigars/exclusiveCustomSampler.asp" style="line-height: 25px; color: rgb(71, 42, 24);" id="Brand SamplersLink">Gurkha Sampler </a></li> </ul> </div> </td> <td class="CommonSimpleTabStripTab" onmouseover="tabOver(this); document.getElementById('ComDropDown4').style.display = 'inline';" onmouseout="tabOut(this); document.getElementById('ComDropDown4').style.display = 'none';"> <a style="float: right; display: block; height: 30px; line-height: 30px; padding-left: 12px; padding-right: 12px; vertical-align: middle;" href="http://www.cigar.com/gifts/index.asp"> Gifts</a> <div id="ComDropDown4" style="border: 1px solid rgb(71, 42, 24); margin: 28px 0px 0px; display: none; background-color: rgb(235, 230, 208); color: rgb(71, 42, 24); position: absolute; float: left; z-index: 200;" onmouseover="document.getElementById('ComDropDown4').style.display = 'inline';" onmouseout="document.getElementById('ComDropDown4').style.display = 'none';"> <ul style="margin: 0px; padding: 0px; width: 100px;"> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/gifts/viewgifts.asp?subcatid=gift_sets'"> <a href="http://www.cigar.com/gifts/viewgifts.asp?subcatid=gift_sets" style="line-height: 25px; color: rgb(71, 42, 24);" id="Gift SetsLink">Best Sellers </a></li> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/cigars/viewsamplers.asp?subcatid=gift_samp'"> <a href="http://www.cigar.com/cigars/viewsamplers.asp?subcatid=gift_samp" style="line-height: 25px; color: rgb(71, 42, 24);" id="Gift SamplersLink">Gift Samplers </a></li> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/accessories/index.asp'"><a href="http://www.cigar.com/accessories/index.asp" style="line-height: 25px; color: rgb(71, 42, 24);" id="AccesoriesLink">Accesories </a></li> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/club/index.asp'"><a href="http://www.cigar.com/club/index.asp" style="line-height: 25px; color: rgb(71, 42, 24);" id="Cigar of the MonthLink">Cigar of the Month </a></li> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/gifts/certificates.asp'"><a href="http://www.cigar.com/gifts/certificates.asp" style="line-height: 25px; color: rgb(71, 42, 24);" id="Cigar of the MonthLink">Gift Certificates </a></li> </ul> </div> </td> <td class="CommonSimpleTabStripTab" onmouseover="tabOver(this); document.getElementById('ComDropDown5').style.display = 'inline';" onmouseout="tabOut(this); document.getElementById('ComDropDown5').style.display = 'none';"> <a style="float: right; display: block; height: 30px; line-height: 30px; padding-left: 12px; padding-right: 12px; vertical-align: middle;" href="http://www.cigar.com/accessories/index.asp"> Accessories</a> <div id="ComDropDown5" style="border: 1px solid rgb(71, 42, 24); margin: 28px 0px 0px; display: none; background-color: rgb(235, 230, 208); color: rgb(71, 42, 24); position: absolute; float: left; z-index: 200;" onmouseover="document.getElementById('ComDropDown5').style.display = 'inline';" onmouseout="document.getElementById('ComDropDown5').style.display = 'none';"> <ul style="margin: 0px; padding: 0px; width: 100px;"> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/accessories/viewaccessories.asp?subcatid=acc_hum'"> <a href="http://www.cigar.com/accessories/viewaccessories.asp?subcatid=acc_hum" style="line-height: 25px; color: rgb(71, 42, 24);" id="HumidorsLink">Humidors </a></li> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/accessories/viewaccessories.asp?subcatid=acc_cutt'"> <a href="http://www.cigar.com/accessories/viewaccessories.asp?subcatid=acc_cutt" style="line-height: 25px; color: rgb(71, 42, 24);" id="CuttersLink">Cutters </a></li> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/accessories/viewaccessories.asp?subcatid=acc_lite'"> <a href="http://www.cigar.com/accessories/viewaccessories.asp?subcatid=acc_lite" style="line-height: 25px; color: rgb(71, 42, 24);" id="LightersLink">Lighters </a></li> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/accessories/viewaccessories.asp?subcatid=acc_case'"> <a href="http://www.cigar.com/accessories/viewaccessories.asp?subcatid=acc_case" style="line-height: 25px; color: rgb(71, 42, 24);" id="CasesLink">Cases </a> </li> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/accessories/viewaccessories.asp?subcatid=acc_humf'"> <a href="http://www.cigar.com/accessories/viewaccessories.asp?subcatid=acc_humf" style="line-height: 25px; color: rgb(71, 42, 24);" id="HumidificationLink">Humidification </a></li> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/accessories/viewaccessories.asp?subcatid=acc_book'"> <a href="http://www.cigar.com/accessories/viewaccessories.asp?subcatid=acc_book" style="line-height: 25px; color: rgb(71, 42, 24);" id="BooksLink">Books </a> </li> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/accessories/viewaccessories.asp?subcatid=acc_ash'"> <a href="http://www.cigar.com/accessories/viewaccessories.asp?subcatid=acc_ash" style="line-height: 25px; color: rgb(71, 42, 24);" id="AshtraysLink">Ashtrays </a></li> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/accessories/viewaccessories.asp?subcatid=acc_misc'"> <a href="http://www.cigar.com/accessories/viewaccessories.asp?subcatid=acc_misc" style="line-height: 25px; color: rgb(71, 42, 24);" id="OtherLink">Other </a> </li> </ul> </div> </td> <td class="CommonSimpleTabStripTab" onmouseover="tabOver(this);" onmouseout="tabOut(this);" onclick="window.location = 'http://www.cigar.com/sales/index.asp'"> <a style="float: right; display: block; height: 30px; line-height: 30px; padding-left: 12px; padding-right: 12px; vertical-align: middle;" href="http://www.cigar.com/sales/index.asp"> Sales</a> </td> <td class="CommonSimpleTabStripTab" onmouseover="tabOver(this); document.getElementById('ComDropDown8').style.display = 'inline';" onmouseout="tabOut(this); document.getElementById('ComDropDown8').style.display = 'none';"> <a style="float: right; display: block; height: 30px; line-height: 30px; padding-left: 12px; padding-right: 12px; vertical-align: middle;" href="http://www.cigar.com/cs/">Community</a> <div id="ComDropDown8" style="border: 1px solid rgb(71, 42, 24); margin: 28px 0px 0px; display: none; background-color: rgb(235, 230, 208); color: rgb(71, 42, 24); position: absolute; float: left; z-index: 200;" onmouseover="document.getElementById('ComDropDown8').style.display = 'inline';" onmouseout="document.getElementById('ComDropDown8').style.display = 'none';"> <ul style="margin: 0px; padding: 0px; width: 100px;"> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/cs/forums/'"><a href="http://www.cigar.com/cs/forums/" style="line-height: 25px; color: rgb(71, 42, 24);" id="ForumsLink">Forums </a> </li> <li class="CommonSimpleTabStripTabSub" style="margin: 0px; padding: 3px; text-align: left; list-style: none outside none;" onmouseover="tabOverSub(this); " onmouseout="tabOutSub(this); " onclick="window.location = 'http://www.cigar.com/cs/blogs/'"><a href="http://w

    Read the article

  • Using C# FindControl to find a user-control in the master page

    - by Jisaak
    So all I want to do is simply find a user control I load based on a drop down selection. I have the user control added but now I'm trying to find the control so I can access a couple properties off of it and I can't find the control for the life of me. I'm actually doing all of this in the master page and there is no code in the default.aspx page itself. Any help would be appreciated. MasterPage.aspx <body> <form id="form1" runat="server"> <div> <asp:ScriptManager runat="server"> </asp:ScriptManager> </div> <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false" OnLoad="UpdatePanel2_Load"> <ContentTemplate> <div class="toolbar"> <div class="section"> <asp:DropDownList ID="ddlDesiredPage" runat="server" AutoPostBack="True" EnableViewState="True" OnSelectedIndexChanged="goToSelectedPage"> </asp:DropDownList> &nbsp; <asp:DropDownList ID="ddlDesiredPageSP" runat="server" AutoPostBack="True" EnableViewState="True" OnSelectedIndexChanged="goToSelectedPage"> </asp:DropDownList> <br /> <span class="toolbarText">Select a Page to Edit</span> </div> <div class="options"> <div class="toolbarButton"> <asp:LinkButton ID="lnkSave" CssClass="modal" runat="server" OnClick="lnkSave_Click"><span class="icon" id="saveIcon" title="Save"></span>Save</asp:LinkButton> </div> </div> </div> </ContentTemplate> <Triggers> </Triggers> </asp:UpdatePanel> <div id="contentContainer"> <asp:UpdatePanel ID="UpdatePanel1" runat="server" OnLoad="UpdatePanel1_Load" UpdateMode="Conditional" ChildrenAsTriggers="False"> <ContentTemplate> <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="lnkHome" EventName="Click" /> <asp:AsyncPostBackTrigger ControlID="rdoTemplate" EventName="SelectedIndexChanged" /> </Triggers> </asp:UpdatePanel> </div> MasterPage.cs protected void goToSelectedPage(object sender, System.EventArgs e) { temp1 ct = this.Page.Master.LoadControl("temp1.ascx") as temp1; ct.ID = "TestMe"; this.UpdatePanel1.ContentTemplateContainer.Controls.Add(ct); } //This is where I CANNOT SEEM TO FIND THE CONTROL //////////////////////////////////////// protected void lnkSave_Click(object sender, System.EventArgs e) { UpdatePanel teest = this.FindControl("UpdatePanel1") as UpdatePanel; Control test2 = teest.ContentTemplateContainer.FindControl("ctl09") as Control; temp1 test3 = test2.FindControl("TestMe") as temp1; string maybe = test3.Col1TopTitle; } Here I don't understand what it's telling me. for "par" I get "ctl09" and I have no idea how I am supposed to find this control. temp1.ascx.cs protected void Page_Load(object sender, EventArgs e) { string ppp = this.ID; string par = this.Parent.ID; }

    Read the article

  • ModalPopupExtender and validation problems

    - by Malachi
    The problem I am facing is that when there is validation on a page and I am trying to display a model pop-up, the pop-up is not getting displayed. And by using fire-bug I have noticed that an error is being thrown. The button that is used to display the pop-up has cause validation set to false so I am stuck as to what is causing the error. I have created a sample page to isolate the problem that I am having, any help would be greatly appreciated. The Error function () {Array.remove(Page_ValidationSummaries, document.getElementById("ValidationSummary1"));}(function () {var fn = function () {AjaxControlToolkit.ModalPopupBehavior.invokeViaServer("mpeSelectClient", true);Sys.Application.remove_load(fn);};Sys.Application.add_load(fn);}) is not a function http://localhost:1131/WebForm1.aspx Line 136 ASP <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="CLIck10.WebForm1" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %> <!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"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <div> <asp:Button ID="btnPush" runat="server" Text="Push" CausesValidation="false" onclick="btnPush_Click" /> <asp:TextBox ID="txtVal" runat="server" /> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtVal" ErrorMessage="RequiredFieldValidator" /> <asp:ValidationSummary ID="ValidationSummary1" runat="server" /> <asp:Panel ID="pnlSelectClient" Style="display: none" CssClass="box" runat="server"> <asp:UpdatePanel ID="upnlSelectClient" runat="server"> <ContentTemplate> <asp:Button ID="btnOK" runat="server" UseSubmitBehavior="true" Text="OK" CausesValidation="false" OnClick="btnOK_Click" /> <asp:Button ID="btnCancel" runat="server" Text="Cancel" CausesValidation="false" OnClick="btnCancel_Click" /> </ContentTemplate> </asp:UpdatePanel> </asp:Panel> <input id="popupDummy" runat="server" style="display:none" /> <ajaxToolkit:ModalPopupExtender ID="mpeSelectClient" runat="server" TargetControlID="popupDummy" PopupControlID="pnlSelectClient" OkControlID="popupDummy" BackgroundCssClass="modalBackground" CancelControlID="btnCancel" DropShadow="true" /> </div> </form> Code Behind using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace CLIck10 { public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void btnOK_Click(object sender, EventArgs e) { mpeSelectClient.Hide(); } protected void btnCancel_Click(object sender, EventArgs e) { mpeSelectClient.Hide(); } protected void btnPush_Click(object sender, EventArgs e) { mpeSelectClient.Show(); } } }

    Read the article

  • asp.net ModalPopupExtender : need to show scroll bar when overflow

    - by DavRob60
    I display a gridview in a ModalPopupExtender. When the screen resolution is to small, the pop-up is to big to all be displayed on the page. I just want to add scroll bar to the pop-up when this happen. I know it's probably some CSS, but all I tried did not work. here some base css .modalTextBoxBackground { background-color:Gray; filter:alpha(opacity=70); opacity:0.7; } .modalTextBox { border: 1px solid #FFFFFF; background-color: #0066CC; color: #00FFFF; } here some code from the aspx <asp:Panel ID="OptionSelectionPanel" runat="server" CssClass="modalTextBox"> <asp:UpdatePanel ID="OptionSelectionUpdatePanel" runat="server" UpdateMode="Conditional" > <Triggers> <asp:asyncPostBackTrigger ControlID="TemplateSelection" /> </Triggers> <ContentTemplate> <table class="EditRow"> <tr class="HeaderFooter"> <td colspan="3" class="modalTextBoxTitle"> Add options to Quote </td> </tr> <tr> <td> Manufacturer </td> <td> <asp:DropDownList ID="OptionManufacturerFilter" runat="server" DataSourceID="OptionManufacturerDataSource" DataTextField="Name" DataValueField="Code" AutoPostBack="True" > </asp:DropDownList> </td> </tr> <tr> <td colspan="3"> <asp:GridView ID="NewOptionSelection" runat="server" DataSourceID="AvailableOptions" DataKeyNames="Option_Id" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="false"> <Columns> <asp:BoundField DataField="category_Descr" HeaderText="Category" SortExpression="category_Descr,subcategory_Descr,code" /> <asp:BoundField DataField="subcategory_Descr" HeaderText="Sub-Category" SortExpression="subcategory_Descr,code" /> <asp:BoundField DataField="Manuf_Name" HeaderText="Manufacturer" SortExpression="Manuf_Name"/> </Columns></asp:GridView> </td> </tr> <tr class="HeaderFooter"> <td colspan="3" class="Center"> <asp:Button ID="OptionSelectionClose" runat="server" Text="Close" /> </td> </tr> </table> </ContentTemplate> </asp:UpdatePanel> </asp:Panel> <asp:Button runat="server" ID="HiddenTargetControlForOptionSelectionModalPopup" style="display:none"/> <cc1:ModalPopupExtender ID="OptionSelectionModalPopupExtender" runat="server" TargetControlID="HiddenTargetControlForOptionSelectionModalPopup" PopupControlID="OptionSelectionPanel" BackgroundCssClass="modalTextBoxBackground" />

    Read the article

  • ModalPopupExtender z-index value decreases after every show

    - by ryanulit
    This is a new one I have never seen before. I have a gridview containing a bunch of categories that can be edited by clicking on the respective "Edit" link within the gridview. The modalpopupextender is then shown programmatically (.show() method) and the user is allowed to edit the category. Then the modal popup is programmtically hidden (.hide() method) when the user presses "Update" or "Cancel". For some reason after every new show of the modal popup, the z-index is decreasing by 1000 until it is hidden behind everything on my page. It starts at 7000 for the very first show. Therefore the user would not be able to edit an infinite number of categories if they wanted to. Any ideas why this is happening? Css class used on modalpopupextender: DIV.box-pop { border: #95aab9 1px solid; background-color: #ECF1F5; display: block; position: relative; margin: -6px 6px 6px -6px; padding: 4px; z-index: 10000; } Panel used for popup: <asp:Panel ID="PanelModify" runat="server" Width="250px" CssClass="box-pop"> <asp:UpdatePanel ID="UpdatePanelModify" runat="server" UpdateMode="Conditional"> <ContentTemplate> <table width="100%" cellpadding="3" cellspacing="3"> <tr> <td> <div class="box"> <h1> <span><strong> <asp:Literal ID="LiteralModalTitle" runat="server" /></strong></span> </h1> <table border="0" width="100%"> <tr> <td> <asp:TextBox ID="TextBoxModifiedText" runat="server" Width="173px" ValidationGroup="Modify"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidatorModifiedText" runat="server" ValidationGroup="Modify" ErrorMessage="*" ControlToValidate="TextBoxModifiedText" Display="Dynamic"> </asp:RequiredFieldValidator> </td> </tr> <tr> <td> <asp:Button ID="ButtonUpdate" runat="server" Text="Update" ValidationGroup="Modify" /><asp:Button ID="ButtonInsert" runat="server" Text="Insert" ValidationGroup="Modify" /> &nbsp; <asp:Button ID="ButtonCancel" runat="server" Text="Cancel" CausesValidation="false" /> </td> </tr> </table> </div> </td> </tr> </table> </ContentTemplate> </asp:UpdatePanel> </asp:Panel> <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtenderModify" runat="server" PopupControlID="PanelModify" TargetControlID="ButtonHideModify" BackgroundCssClass="modalBackground"> </ajaxToolkit:ModalPopupExtender> <asp:Button ID="ButtonHideModify" runat="server" Style="display: none;" />

    Read the article

< Previous Page | 7 8 9 10 11 12  | Next Page >