Search Results

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

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

  • (C#) Get index of current foreach iteration

    - by Graphain
    Hi, Is there some rare language construct I haven't encountered (like the few I've learned recently, some on Stack Overflow) in C# to get a value representing the current iteration of a foreach loop? For instance, I currently do something like this depending on the circumstances: int i=0; foreach (Object o in collection) { ... i++; } Answers: @bryansh: I am setting the class of an element in a view page based on the position in the list. I guess I could add a method that gets the CSSClass for the Objects I am iterating through but that almost feels like a violation of the interface of that class. @Brad Wilson: I really like that - I've often thought about something like that when using the ternary operator but never really given it enough thought. As a bit of food for thought it would be nice if you could do something similar to somehow add (generically to all IEnumerable objects) a handle on the enumerator to increment the value that an extension method returns i.e. inject a method into the IEnumerable interface that returns an iterationindex. Of course this would be blatant hacks and witchcraft... Cool though... @crucible: Awesome I totally forgot to check the LINQ methods. Hmm appears to be a terrible library implementation though. I don't see why people are downvoting you though. You'd expect the method to either use some sort of HashTable of indices or even another SQL call, not an O(N) iteration... (@Jonathan Holland yes you are right, expecting SQL was wrong) @Joseph Daigle: The difficulty is that I assume the foreach casting/retrieval is optimised more than my own code would be. @Jonathan Holland: Ah, cheers for explaining how it works and ha at firing someone for using it.

    Read the article

  • Calling server side method as filling value inside a textbox from calendar extender

    - by Dharmendra Singh
    I have a text box which i m filling of date from the calendar extender and the code is as below:- <label for="input-one" class="float"><strong>Date</strong></label><br /> <asp:TextBox ID="txtDate" runat="server" CssClass="inp-text" Enabled="false" AutoPostBack="true" Width="300px" ontextchanged="txtDate_TextChanged"></asp:TextBox> <asp:ImageButton ID="btnDate2" runat="server" AlternateText="cal2" ImageUrl="~/App_Themes/Images/icon_calendar.jpg" style="margin-top:auto;" CausesValidation="false" onclick="btnDate2_Click" /> <ajaxToolkit:CalendarExtender ID="calExtender2" runat="server" Format="dddd, MMMM dd, yyyy" OnClientDateSelectionChanged="CheckDateEalier" PopupButtonID="btnDate2" TargetControlID="txtDate" /> <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="txtDate" ErrorMessage="Select a Date" Font-Bold="True" Font-Size="X-Small" ForeColor="Red"></asp:RequiredFieldValidator><br /> Javascript code is :- function CheckDateEalier(sender, args) { sender._textbox.set_Value(sender._selectedDate.format(sender._format)) } My requirement is that as the date is entered in to the textbox, I want to call this method: public void TimeSpentDisplay() { string date = txtDate.Text.ToString(); DateTime dateparsed = DateTime.ParseExact(date, "dddd, MMMM dd, yyyy", null); DateTime currentDate = System.DateTime.Now; if (dateparsed.Date > currentDate.Date) { divtimeSpent.Visible = true; } if (dateparsed.Date < currentDate.Date) { divtimeSpent.Visible = true; } if (dateparsed.Date == currentDate.Date) { divtimeSpent.Visible = false; } } Please help me that how i achieve this as i m calling this method inside txtDate_TextChanged method but the event is not firing as the text is changed inside the textbox. Please suggest how I can achieve this or give me an alternate idea to fulfill my requirement.

    Read the article

  • Dynamic Column that contains a Repeater

    - by djbyter
    How would I go about doing this programatically? I can do this just fine declaratively, using a template column and then using something like this: ... <TemplateGridColumn> <ItemTemplate> <div> <asp:Image ID="groupImg" CssClass="groupImg" runat="server"/> <asp:Repeater ID="groupItemRpt" runat="server"> <HeaderTemplate> <ul class="groupItemList"> </HeaderTemplate> <ItemTemplate> <li> <asp:Image ID="itemImg" runat="server" /> <asp:HiddenField ID="itemValue" runat="server" /> </li> </ItemTemplate> <FooterTemplate> </ul> </FooterTemplate> </asp:Repeater> </div> </ItemTemplate> </TemplateGridColumn> ... I am dynamically creating this grid based on the data, so I'm already added columns with one set of controls. But now I need to figure out how to show multiple images, which expand/contract if the groupImg image control is clicked (i just toggle the ul) .. Can anyone point me in the right direction? Thanks.

    Read the article

  • TextBox doesn't fire TextChanged Event on IE 8, AutoPostback is true

    - by MaikoID
    Hi guys, I have the same thing, there are many TextBoxes with the event TextChanged set and with AutoPostback = true, and works in all browsers (Chrome, Opera, Firefox 3.6) except in IE 8, IE 6/7 I didn't test. I don't want to put the onblur event in all my TextBoxs because there are many pages with many TextBox that use this event. Description I'm using a masterPage, in the aspx i have <asp:TextBox ID="txtCnpj" runat="server" CssClass="txt" Width="200px" onkeyup="Mascara(this,Cnpj)" onkeydown="Mascara(this,Cnpj)" MaxLength="18" AutoPostBack="true" ValidationGroup="txtCnpj" OnTextChanged="txtCnpj_TextChanged"></asp:TextBox> in the aspx.cs protected void txtCnpj_TextChanged(object sender, EventArgs e) { if (CredorInvestimento.GetCredorInvestimento(txtCnpj.Text) != null) { ((TextBox)sender).Text = ""; ((TextBox)sender).Focus(); rfvCnpj.ErrorMessage = "Duplicado"; Page.Validate(txtCnpj.ID); } else txtNome.Focus(); } Thanks! ps: I really doesn't like of asp.net I spend more time fixing errors than developing new functions. ps: sorry for my english. ps: if i remove the onkeydown and onkeyup events the textchanged fire in IE, but i realy this events too.

    Read the article

  • Overridden button control escaping content. How to stop it?

    - by RemotecUk
    Hi, I've got an ASP.Net button control that I have overridden to provide different functionality. the code looks as follows.. I'm overriding the Render method to surround the control with an <a>... /// <summary> /// Render Method /// </summary> /// <param name="writer"></param> protected override void Render(HtmlTextWriter writer) { base.CssClass = "euva-button-decorated"; writer.Write("<a class=\"euva-button\">"); base.Render(writer); writer.Write("</a>"); } When I check the generated source on the page, I find that where ASP.Net has injected its click handler it does the following... <a class="euva-button"><input type="submit" name="TestButton" value="Test Button" onclick="clickOnce(this);WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;TestButton&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" id="TestButton" class="euva-button-decorated" /></a> ... it seems to be escaping the output for the double quotes which means that the browser cannot understand the javascript. How do I make the render method not escape the injected ASP.Net client click handler ?? Note I also have my own client click handler which is declared declaratively in the page mark-up.

    Read the article

  • How can I include additional markup within a 'Content' inner property within 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;

    Read the article

  • ASP.NET validators alignment issue

    - by Mahesh
    Hi, I am developing contactus webpage which have a input field called Email. It is validated against a required field validator and regular expression validator with appropriate messages. Required: Enter Email Regular Expression: Invalid Email I am setting these two as given below: <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox> <font color="#FF0000">*</font> <asp:RequiredFieldValidator ID="rfvemail" CssClass="error_text" ControlToValidate="txtEmail" runat="server" ErrorMessage="Enter email address."></asp:RequiredFieldValidator> <asp:RegularExpressionValidator ID="revemail" runat="server" ControlToValidate="txtEmail" ErrorMessage="Invalid Email" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator> My problem is both Enter Email and Invalid Email is occupying its own space. For Ex: If I leave email as empty space and press submit, Enter Email is displaying right next to it. If I enter invalid email(xxx), Enter Email is off but taking the space, Invalid Email message is displayed after these space taken by 'Enter Email' before. Is there any way to remove this space?? Mahesh

    Read the article

  • VS2010 and CSS: What is the best strategy to individually position form controls

    - by George
    OK, I have a ton of controls on my page that I need to individually place. I need to set a margin here, a padding there, etc. None of these particular styles that I want to apply will be applied to more than control. What is the bets practice for determining at which level the style is placed, etc? OK, my choices are 1) External CSS file 1A) Using ClientIdMode = Auto (the default) I could assign a unique CssClass value to the ASP.NET control and, in the external CSS file, create a class selector that would only be applied to that one control. 1B) User Client ID = Predicatable In the external CSS file, I could determine what the ID will be for the controls of interest and create an ID selector (#ControlID{Style} ). However, I fear maintenance issues due to including/removing parent containers that would cause the ID to change. 1C) User Client ID = Static. I could choose static IDs for the controls such that I minimize the likelihood of a clash with auto generated IDs (perhaps by prefixing the ID with "StaticID_" and use an external stylesheet with ID selectors. 2) I could place the style right on the control. The only disadvantage here, as I see it, is that style info is brought down each time instead of being cached , which is what I'd get using an external CSS. If a style isn't resused, I personally don't see much benefit to placing it in an external file, though please explain why if you disagree. Is there moire of a reason that "It's nice to have all the CSS in one place?"

    Read the article

  • Text box creates gap when floated left in IE7

    - by Sixfoot Studio
    Hi, I've got a left rounded corner box - textbox - right rounded corner box which all make up part of a search box. All's well in FF, Chrome, IE8 but not IE7. I've checked it using the debug tool and and I have tried a number of options, none of which want to work at the moment, so I am hoping someone might know what this issue (bug) might be please? Here's a snippet of my code: <div class="roundBox4"> <img src="../App_Themes/MyChoice2010/Images/reality-box-top.gif" width="228" height="8" /><img src="../App_Themes/MyChoice2010/Images/reality-box-locate.gif" width="228" height="49" /> <asp:ContentPlaceHolder ID="Box4Content" runat="server"> </asp:ContentPlaceHolder> <div class="locateABroker"> <img src="../App_Themes/MyChoice2010/Images/locate-broker-left.gif" class="locateBrokerLeft" height="19" width="3" /><asp:TextBox ID="TextBox1" CssClass="locateBrokerCenter" runat="server"></asp:TextBox><img src="../App_Themes/MyChoice2010/Images/locate-broker-right.gif" height="19" width="3" class="locateBrokerRight" /> <a href="" class="locateBrokerSubmit">Submit</a><img src="../App_Themes/MyChoice2010/Images/box-arrow.gif" class="linkArrow" width="8" height="14" /> </div>

    Read the article

  • ASP.NET DropDownList posting ""

    - by Daniel
    I am using ASP.NET forms version 3.5 in VB I have a dropdownlist that is filled with data from a DB with a list of countries The code for the dropdown list is <label class="ob_label"> <asp:DropDownList ID="lstCountry" runat="server" CssClass="ob_forminput"> </asp:DropDownList> Country*</label> And the code that the list is Dim selectSQL As String = "exec dbo.*******************" ' Define the ADO.NET objects. Dim con As New SqlConnection(connectionString) Dim cmd As New SqlCommand(selectSQL, con) Dim reader As SqlDataReader ' Try to open database and read information. Try con.Open() reader = cmd.ExecuteReader() ' For each item, add the author name to the displayed ' list box text, and store the unique ID in the Value property. Do While reader.Read() Dim newItem As New ListItem() newItem.Text = reader("AllSites_Countries_Name") newItem.Value = reader("AllSites_Countries_Id") CType(LoginViewCart.FindControl("lstCountry"), DropDownList).Items.Add(newItem) Loop reader.Close() CType(LoginViewCart.FindControl("lstCountry"), DropDownList).SelectedValue = 182 Catch Err As Exception Response.Redirect("~/error-on-page/") MailSender.SendMailMessage("*********************", "", "", OrangeBoxSiteId.SiteName & " Error Catcher", "<p>Error in sub FillCountry</p><p>Error on page:" & HttpContext.Current.Request.Url.AbsoluteUri & "</p><p>Error details: " & Err.Message & "</p>") Response.Redirect("~/error-on-page/") Finally con.Close() End Try When the form is submitted an error occurs which says that the string "" cannot be converted to the datatype integer. For some reason the dropdownlist is posting "" rather than the value for the selected country.

    Read the article

  • How do you reenable a validation control w/o it simultaneously performing an immediate validation?

    - by Velika2
    When I called this function to enable a validator from client javascript: `ValidatorEnable(document.getElementById('<%=valPassportOtherText.ClientID%>'), true); //enable` validation control the required validation control immediately performed it validation, found the value in the associated text box blank and set focus to the textbox (because SetFocusOnError was set to true). As a result, the side effect was that focus was shifted to the control that was associated with the Validation control, i teh example, txtSpecifyOccupation. <asp:TextBox ID="txtSpecifyOccupation" runat="server" AutoCompleteType="Disabled" CssClass="DefaultTextBox DefaultWidth" MaxLength="24" Rows="2"></asp:TextBox> <asp:RequiredFieldValidator ID="valSpecifyOccupation" runat="server" ControlToValidate="txtSpecifyOccupation" ErrorMessage="1.14b Please specify your &lt;b&gt;Occupation&lt;/b&gt;" SetFocusOnError="True">&nbsp;Required</asp:RequiredFieldValidator> Perhaps there is a way to enable the (required) validator without having it simultaneously perform the validation (at least until the user has tabbed off of it?) I'd like validation of the txtSpecifyOccupation textbox to occur only on a Page submit or when the user has tabbed of the required txtSpecifyoccupation textbox. How can I achieve this?

    Read the article

  • Explicit localization problem

    - by X-Dev
    when trying to translate the confirmation message to Norwegian i get the following error: Cannot have more than one binding on property 'OnClientClick' on 'System.Web.UI.WebControls.LinkButton'. Ensure that this property is not bound through an implicit expression, for example, using meta:resourcekey. i use Explicit localization in the following manner: <asp:LinkButton ID="lnkMarkInvoiced" runat="server" OnClick="lnkMarkInvoiced_OnClick" OnClientClick="<%# Resources: lnkMarkInvoicedResource.OnClientClick%>" Visible="False" CssClass="stdtext" meta:resourcekey="lnkMarkInvoicedResource" ></asp:LinkButton> here's the local resource file entry: <data name="lnkMarkInvoicedResource.OnClientClick" xml:space="preserve"> <value>return confirm('Er du sikker?');</value> if i remove the meta attribute i get the English text(default). how do i get the Norwegian text appearing without resorting to using the code behind? Update: removing the meta attribute prevents the exception from occurring but the original problem still exists. I can't get the Norwegian text to show. only the default English text shows. Another Update: I know this question is getting old but i still can't get the Norwegian text to display. If anyone has some tips please post a response.

    Read the article

  • asp.net: saving js file with c# commands...

    - by ile
    <head runat="server"> <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title> <link href="../../Content/css/layout.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="/Areas/CMS/Content/js/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="/Areas/CMS/Content/js/jquery.jeditable.js"></script> <script type="text/javascript" src="/Areas/CMS/Content/js/jeditable.js"></script> <script type="text/javascript"> $(document).ready(function() { $(".naslov_vijesti").editable('<%=Url.Action("UpdateSettings","Article") %>', { submit: 'ok', submitdata: {field: "Title"}, cancel: 'cancel', cssclass: 'editable', width: '99%', placeholder: 'emtpy', indicator: "<img src='../../Content/img/indicator.gif'/>" }); }); </script> </head> This is head tag of site.master file. I would like to remove this multiline part from head and place it in jeditable.js file, which is now empty. If I do copy/paste, then <% %> part won't be executed. In PHP I would save js file as jeditable.js.php and server would compile code that is in <?php ?> tag. Any ideas how to solve this problem? Thanks in advance, Ile

    Read the article

  • ASP.Net ListBox selections not working in Panel?

    - by larryq
    Hi everyone, I'm having trouble processing a listbox after selecting some items from it. In my markup, the listbox is contained within an asp:panel and is populated during page load in the codebehind. That part works fine. It's when I select various items and submit that I have trouble. My handler loops through the listbox items but doesn't see any as being selected. I'm not sure why. Here's the markup: <asp:Panel ID="panEdit" runat="server" Height="180px" Width="400px" CssClass="ModalWindow"> <table width="100%"> <asp:label runat = "server">Choose your items</asp:label> <tr> <td> <asp:ListBox ID="lstFundList" runat="server" SelectionMode="Multiple" OnLoad="lstFundList_LoadData"> </asp:ListBox> </td> </tr> </table> <asp:Button ID="btnUpdate" runat="server" Text="Update" OnClick="btnUpdate_OnClick"/> <asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClientClick="$find('ModalPopupExtender1').hide(); return false;" /> </asp:Panel> In my btnUpdate_OnClick handler I can't see any listbox items that are marked as selected. I assume something strange is going on with respect to postback and the panel?

    Read the article

  • DroDownlist in DataGrid produces Error

    - by S Nash
    I have a DataGrid and everytime I change value of it's embeded dropdwonlist I get: "System.Web.HttpException: The IListSource does not contain any data sources." I have a data grid which loads fine: Name column is editable. I have a dropdownlist these : DataDataGrid gets its value from a table. (Select Name, Address From Persons) Dropdown list also gets list of names from the same table. So DataGrid and dropdownlist are bound to 2 different datasets. Here is my code for dataGrid" <Columns> <ASP:ButtonColumn Text="Delete" CommandName="Delete"></ASP:ButtonColumn> <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn> <ASP:TemplateColumn HeaderText="Name" SortExpression="FY" HeaderStyle-HorizontalAlign="center" HeaderStyle-Wrap="True"> <ItemStyle Wrap="false" HorizontalAlign="left" /> <ItemTemplate> <ASP:Label ID="Name" Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>' runat="server"/> </ItemTemplate> <EditItemTemplate> <ASP:DropDownList id="ddlName" cssClass="DropDownList" runat="server" datasource="<%#allNames%>" DataTextField= "Name" DataValueField="ID" Defaultvalue='<%# DataBinder.Eval(Container.DataItem, "ID") %>' OnPreRender="SetDefaultListItem" accessKey="I" AutoPostBack="true" /> </EditItemTemplate> </ASP:TemplateColumn> <asp:BoundColumn DataField="Address" ReadOnly="True" HeaderText="Address"></asp:BoundColumn> </Columns> Error happens here : dg.DataSource = ds dg.DataBind() Any ideas how to solve this issues? All I want is a DataGrid with a editable column ,which can be edited by choosing one of the value of in a dropdownlist.

    Read the article

  • ASP.Net Problem with Event Handlers and Control Creation Timing

    - by Oliver Weichhold
    What I am trying to achieve here is to display a number of LinkButtons in a RadGrid Column. The buttons are generated from a collection property member of the bound grid row item. The CollectionLinkButton control is nothing more than a asp:Panel derived control that populates its Child Controls from "DataItem.SomeCollection" and this is working fine. The problem I am facing is with this part: Collection='<%# DataBinder.Eval(Container, "DataItem.SomeCollection") %' This is because databound Collection Property is populated so late in the lifecycle of the page that the LinkButton Controls that the CollectionLinkButton class creates from the collection are not available yet during Postback when the Click event Handler is supposed to fire and I have currently no idea how to solve this problem. <radG:RadGrid ID="grid" runat="server" DataSourceID="ds_AB"> <MasterTableView> <Columns> <radG:GridTemplateColumn> <ItemTemplate> <local:CollectionLinkButton ID="LinkButton1" runat="server" CssClass="EntityLinkButton" Collection='<%# DataBinder.Eval(Container, "DataItem.SomeCollection") %>' CollectionProperty="Id" CollectionDisplayProperty="Name" Text='<%# DataBinder.Eval(Container, "DataItem.Name") %>'</local:CollectionLinkButton> </ItemTemplate> </radG:GridTemplateColumn>

    Read the article

  • How do you reenable a validation control w/o it simultaneously perform an immediate validation?

    - by Velika2
    When I called this function to enable a validator from client javascript: `ValidatorEnable(document.getElementById('<%=valPassportOtherText.ClientID%>'), true); //enable` validation control the required validation control immediately performed it validation, found the value in the associated text box blank and set focus to the textbox (because SetFocusOnError was set to true). As a result, the side effect was that focus was shifted to the control that was associated with the Validation control, i teh example, txtSpecifyOccupation. <asp:TextBox ID="txtSpecifyOccupation" runat="server" AutoCompleteType="Disabled" CssClass="DefaultTextBox DefaultWidth" MaxLength="24" Rows="2"></asp:TextBox> <asp:RequiredFieldValidator ID="valSpecifyOccupation" runat="server" ControlToValidate="txtSpecifyOccupation" ErrorMessage="1.14b Please specify your &lt;b&gt;Occupation&lt;/b&gt;" SetFocusOnError="True">&nbsp;Required</asp:RequiredFieldValidator> Perhaps there is a way to enable the (required) validator without having it simultaneously perform the validation (at least until the user has tabbed off of it?) I'd like validation of the txtSpecifyOccupation textbox to occur only on a Page submit or when the user has tabbed of the required txtSpecifyoccupation textbox. How can I achieve this?

    Read the article

  • Saving js file with c# commands...

    - by ile
    <head runat="server"> <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title> <link href="../../Content/css/layout.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="/Areas/CMS/Content/js/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="/Areas/CMS/Content/js/jquery.jeditable.js"></script> <script type="text/javascript" src="/Areas/CMS/Content/js/jeditable.js"></script> <script type="text/javascript"> $(document).ready(function() { $(".naslov_vijesti").editable('<%=Url.Action("UpdateSettings","Article") %>', { submit: 'ok', submitdata: {field: "Title"}, cancel: 'cancel', cssclass: 'editable', width: '99%', placeholder: 'emtpy', indicator: "<img src='../../Content/img/indicator.gif'/>" }); }); </script> </head> This is head tag of site.master file. I would like to remove this multiline part from head and place it in jeditable.js file, which is now empty. If I do copy/paste, then <% %> part won't be executed. In PHP I would save js file as jeditable.js.php and server would compile code that is in <?php ?> tag. Any ideas how to solve this problem? Thanks in advance, Ile

    Read the article

  • Custom control doesn't fire validation

    - by Ed Woodcock
    I've written a custom ASP.net control that descends from LinkButton and overrides the Render() method. I'm using it to replace ImageButtons in the site I'm working on so we don't have to have an image for each button. This control works fine, does the required post-backs etc., however it doesn't fire the validators in its validation group. This is obviously an issue. The code for the control is (condensed) as follows: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public class CustomButton : LinkButton { public string SpanCssClass { get; set; } protected override void Render(HtmlTextWriter writer) { if (!Visible) { return; } writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID); writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID); writer.AddAttribute(HtmlTextWriterAttribute.Class, CssClass); string postback = string.IsNullOrEmpty(OnClientClick) ? "javascript:__doPostBack('" + UniqueID + "','');" : OnClientClick; writer.AddAttribute(HtmlTextWriterAttribute.Href, postback); writer.RenderBeginTag(HtmlTextWriterTag.A); writer.AddAttribute(HtmlTextWriterAttribute.Class, SpanCssClass); writer.RenderBeginTag(HtmlTextWriterTag.Span); writer.Write(Text); writer.RenderEndTag(); writer.RenderEndTag(); } } Does anyone know why this would not be causing the validators to fire? I was under the impression that leaving all the other methods in LinkButton un-overridden would leave all the other functionality the same!

    Read the article

  • Getting jQuery datepicker to attach to a TextBox within a ListView

    - by Clay
    I am using the jQuery Datepicker without any problem for TextBox controls that are non-templated. However, I am unable to get the datepicker to work with a TextBox that is in an EditItemTemplate of a ListView control. My latest attempt is to get a handle on this textbox by CSS class name "DateControl", any ideas? <asp:ListVIew id="lvTest" runat="server"> <LayoutTemplate>...</LayoutTemplate> <ItemTemplate>...</ItemTemplate> <EditItemTemplate> <tr> <td> <asp:TextBox ID="txtExpReceiveDate" runat="server" Text='<%#Eval("exp_receive_date","{0:dd-MMM-yy}") %>' CssClass="DateControl" /> </td> </tr> </EditTemplate> </asp:ListView> <script type="text/javascript" language="javascript"> $(document).ready(function () { $('DateControl').datepick({ dateFormat: 'M-dd-yyyy' }); }); </script>

    Read the article

  • .net user control event handler lost on postback

    - by user154008
    I have a menu usercontrol called LeftMenu that has a bulletedlist of linkitems. It's on the ascx page as such: <asp:BulletedList ID="PublisherList" DisplayMode="LinkButton" OnClick="PublisherList_Click" cssClass="Menu" runat="server"></asp:BulletedList> I databind the list in the page_load under if(!isPostBack) I'm having an issue on a page that loads the control. When the page first loads, the event handler fires. However, when the page posts back it no longer fires and in IE8, when I'm debugging, I get "Microsoft JScript runtime error: Object expected" in Visual Studio pointing at "doPostBack('LeftMenu$PublisherList','0')." In FF I don't get the error, but nothing happens. I'm **not loading the control dynamically, it's loaded on the aspx page using: <%@ Register TagPrefix="Standards" TagName="LeftMenu" Src="LeftMenu.ascx" %> <Standards:LeftMenu ID="LeftMenu" runat="server"/> Any ideas of where I'm losing the event handler? I just realized this is happening on another user control I have as well. A text box and a button and I'm using the default button to make sure pressing the enter key uses that button. .Net converts that in the html to: <div id="SearchBarInclude_SearchBar" onkeypress="javascript:return WebForm_FireDefaultButton(event, 'SearchBarInclude_QuickSearchButton')"> so as soon as i enter a key in the box I get a javascript error at the line saying "object expected." It seems like the two issues are related. Edit Again: I think I need to clarify. It's not that I'm clicking on the menu item and it can't find the selected item on postback. I have this search page with the left navigation on it and then the main content of the page is something that causes a postback. Everything is fine with this postback. Once that page has been posted back, now if I click on the bulleted list in the left navigation I get a javascript error and it fails. The page_init for the LeftMenu control is never called.

    Read the article

  • AJAX PopupControl Extender with Bing Maps

    - by Morano88
    Hey! I want to use AJAX PopupControl Extender with a text box so when a user clicks on the text box a popup that contains the Bing Map appears. I'm using the following code but I don't know why it is not working ? <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:Label ID="Label1" runat="server" Font-Bold="true" Font-Size="14px" Text="Click inside the textbox to open AJAX Popup Control:"></asp:Label> <div class="clear"><br /></div> <asp:TextBox ID="TextBox1" CssClass="textbox" runat="server" Width="200px"></asp:TextBox> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2"></script> <script type="text/javascript"> var map = null; function GetMap() { map = new VEMap('myMap'); map.LoadMap(new VELatLong(47.6, -122.33), 10 ,'h' ,false); } </script> </head> <body onload="GetMap();"> <div id='myMap' style="position:relative; width:400px; height:400px;"></div> </body> </html> <ajaxToolkit:PopupControlExtender ID="PopupControlExtender1" runat="server" CommitProperty="foreColor" Position="Right" TargetControlID="TextBox1" PopupControlID="myMap" OffsetX="2" OffsetY="2"> </ajaxToolkit:PopupControlExtender> what's wrong ?

    Read the article

  • how can i change selected value of drop list dynamically

    - by Deepak Gupta
    i want to pick the value from text box and then change the value of dropdown list according to that value <html> <head> <script> function change() { var value = document.getElementById('text').value; document.getElementById("Model").selectedvalue = value } </script> </head> <body> <asp:DropDownList ID="Model" AutoPostBack="false" runat="server" CssClass="styled"> <asp:ListItem Value="None">None</asp:ListItem> <asp:ListItem Value="Enum">Enum</asp:ListItem> <asp:ListItem Value="Sum">Sum</asp:ListItem> <asp:ListItem Value="Multi">Multi</asp:ListItem> <asp:ListItem Value="Xaxis">Xaxis</asp:ListItem> </asp:DropDownList> <input id="text" type="text"/> <input type="button" onclick="change();"/> </body> <html>

    Read the article

  • Run JavaScript code at ASP.NET page load

    - by vaibhav
    I have a radiobox <asp:RadioButtonList CssClass="list" Style="width: 150px" ID="rdo_RSD_ExcerciseRoT" runat="server" Font-Bold="false" RepeatDirection="Horizontal" RepeatLayout="Table" TextAlign="Left" > <asp:ListItem Text="Yes" onclick="en();" Value="Y"></asp:ListItem> <asp:ListItem Text="No" onclick="dis();" Value="N" Selected="True"></asp:ListItem> </asp:RadioButtonList> AS you may see second listitem is selected by default. But issue is, when my page is getting load dis() is not getting called. I want to run dis() on page load too. I tried google, some blogs suggest the use of Page.RegisterStartupScript Method. But I dont exactly know what is the problem and why we should use this above mentioned method. I would appreciate if someone please tell me why this function is not getting called and how to call it. Edit: I am giving Javascript code also, if it helps. <script type="text/javascript"> function dis() { ValidatorEnable(document.getElementById('<%=RequiredFieldValidator32.ClientID%>'), false); } function en() { ValidatorEnable(document.getElementById('<%=RequiredFieldValidator32.ClientID%>'), true); } </script>

    Read the article

  • Setting Vertical-Align for a button

    - by danish
    I have a in a user control. In that, I have added a HTML table in which there is a button. I need to have the buttons aligned to the bottom of the cell. I tried setting the property in the CSS file the style does not gets applied. What is it that I am doing wrong? ASCX file: <link href="CSSFile.css" rel="stylesheet" type="text/css" /> . . . <td> <asp:Button ID="btnOK" runat="server" Text="OK" Width="66px" CssClass="ButtonClass"/> <asp:Button ID="btnClose" runat="server" Text="Close" Width="66px"/> </td> CSS File: ButtonClass { border: thin groove #000000; vertical-align: bottom; color: #000000; background-color: #99FFCC; } The CSS file and the user control reside in the same folder.

    Read the article

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