Search Results

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

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

  • How to populate a dropdownlist with json data in jquery?

    - by Pandiya Chendur
    I am developing a country state cascading dropdown list... I returned json result based on countryId but i dont know how to populate/fill it in a new dropdown listbox... Here is what i am using, function getstate(countryId) { $.ajax({ type: "POST", url: "Reg_Form.aspx/Getstates", data: "{'countryId':" + (countryId) + "}", contentType: "application/json; charset=utf-8", global: false, async: false, dataType: "json", success: function(jsonObj) { alert(jsonObj.d); } }); return false; } And alert gave this, {"Table" : [{"stateid" : "2","statename" : "Tamilnadu"}, {"stateid" : "3","statename" : "Karnataka"}, {"stateid" : "4","statename" : "Andaman and Nicobar"}, {"stateid" : "5","statename" : "Andhra Pradesh"}, {"stateid" : "6","statename" : "Arunachal Pradesh"}]} And my aspx page has this is, <td> <asp:DropDownList ID="DLCountry" runat="server" CssClass="dropDownListSkin" onchange="return getstate(this.value);"> </asp:DropDownList> </td> <td> <asp:DropDownList ID="DLState" runat="server" CssClass="dropDownListSkin"> </asp:DropDownList> </td> Any suggestion how to fill it DLState dropdown...

    Read the article

  • Omit Properties from WebControl Serialization

    - by Laramie
    I have to serialize several objects inheriting from WebControl for database storage. These include several unecessary (to me) properties that I would prefer to omit from serialization. For example BackColor, BorderColor, etc. Here is an example of an XML serialization of one of my controls inheriting from WebControl. <Control xsi:type="SerializePanel"> <ID>grCont</ID> <Controls /> <BackColor /> <BorderColor /> <BorderWidth /> <CssClass>grActVid bwText</CssClass> <ForeColor /> <Height /> <Width /> ... </Control> I have been trying to create a common base class for my controls that inherits from WebControl and uses the "xxxSpecified" trick to selectively choose not to serialize certain properties. For example to ignore an empty BorderColor property, I'd expect [XmlIgnore] public bool BorderColorSpecified() { return !base.BorderColor.IsEmpty; } to work, but it's never called during serialization. I've also tried it in the class to be serialized as well as the base class. Since the classes themselves might change, I'd prefer not to have to create a custom serializer. Any ideas?

    Read the article

  • How can i pull an image and data from a Database?

    - by user1851377
    I am trying to pull data from a Database using C#.net and use a Foreach loop to make it visible on a page. Every time i run the code i only get one item that shows up when i know that there is at least 7 items in the DB. i have placed the code below for the C#. SqlConnection oConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["HomeGrownEnergyConnectionString"].ToString()); string sqlEnergy = "Select * from Product p where p.ProductTypeId=3"; SqlCommand oCmd = new SqlCommand(sqlEnergy, oConnection); DataTable dtenergy = new DataTable(); SqlDataAdapter oDa = new SqlDataAdapter(oCmd); try { oConnection.Open(); ; oDa.Fill(dtenergy); } catch (Exception ex) { lblnodata.Text = ex.Message; return; } finally { oConnection.Close(); } DataTableReader results = dtenergy.CreateDataReader(); if (results.HasRows) { results.Read(); foreach(DataRow result in dtenergy.Rows) { byte[] imgProd = result["ThumnailLocation"] as byte[]; ID.Text = result["ProductID"].ToString(); Name.Text = result["Name"].ToString(); price.Text = FormatPriceColumn(result["Price"].ToString()); } } Here is the code for the asp.net. <div> <asp:Image ID="imgProd" CssClass="ProdImg" runat="server" /> <asp:Label runat="server" ID="ID" /> <asp:Label runat="server" ID="Name" /> <asp:Label runat="server" ID="price" /> <asp:TextBox ID="txtQty" MaxLength="3" runat="server" Width="30px" /> <asp:Button runat="server" ID="Addtocart" Text="Add To Cart" CommandName="AddToCart" ItemStyle-CssClass="btnCol" /> If someone could please help me that would be great thanks.

    Read the article

  • Give Gridview cell font colour according to condition

    - by vim
    How can I give colour to gridview's cell text according to condition. I have a below gridview and I am taking data in gridview by code behind. <asp:GridView ID="GridView3" runat="server" AllowPaging="true" PageSize="5" AutoGenerateColumns="false" Width="100%" OnPageIndexChanging="GridView3_PageIndexChanging" CssClass="Grid"> <RowStyle CssClass="GridRow"/> <Columns> <asp:BoundField HeaderText="No" DataField="id" Visible="false"/> <asp:BoundField HeaderText="Scenario" DataField="Scenario"/> <asp:BoundField HeaderText="Type" DataField="Type"/> <asp:BoundField HeaderText="Station Name" DataField="StationName"/> <asp:BoundField HeaderText="Parameter" DataField="PARAM"/> <asp:BoundField HeaderText="Value" DataField="Value" SortExpression="Value" DataFormatString="{0:F2}"/> </Columns> <PagerStyle BackColor="White" Height="40px" Font-Bold="true" Font- Size="Medium" ForeColor="Green" HorizontalAlign="Center"/> <PagerSettings FirstPageText="First" LastPageText="Last" Mode="NumericFirstLast" PageButtonCount="3" /> <HeaderStyle BackColor="#ABDB78" ForeColor="Black" Height="35px" Font- Size="13px" Font-Names="verdana"/> </asp:GridView> I am binding data with this grid by code behind. protected void ReservGridBind() { string name = Request.QueryString[1].ToString(); string query = "SELECT SD.id,SD.Scenario,SD.Value,PR.Type,PR.StationName,PR.PARAM from sgwebdb.param_reference as PR Inner join sgwebdb.scenario_data as SD ON PR.Param_Id=SD.Param_Id INNER JOIN sgwebdb.qualicision_detail as Q ON SD.SCENARIO=Q.Alternative where PR.Type='Reservoirs' and Q.Alternative='" + name +"'"; this.GridView1.DataSource = PSI.DataAccess.Database.DatabaseManager .GetConnection().GetData(query); GridView1.DataBind(); condition : if text < 0 then blue colour , text > 0 && text < 4 then green colour, text > 4 then red colour. Please help me for this gridview's cell text colour.

    Read the article

  • alternative in .Net to building Tables/TR/TD manually?

    - by egrunin
    I've got a pile of code here that looks like this: if (stateTax > 0) { tr = new TableRow(); tbl.Rows.Add(tr); td = new TableCell(); td.CssClass = "stdLabel"; td.Text = "NY State Tax"; tr.Cells.Add(td); td = new TableCell(); td.Text = string.Format("{0:C}", stateTax); td.CssClass = "justRight"; tr.Cells.Add(td); } This is a horrible hash of data and layout, but creating a special class or control every time something like this comes up seems almost as bad. What I usually do is write a helper function, which is concise but ugly: if (stateTax > 0) MakeRow(tbl, "NY State Tax", "stdLabel", string.Format("{0:C}", stateTax), "justRight"); And now I'm thinking: haven't I done this 100 times before? Isn't there a more modern way? Just to be explicit: it's a whole list of miscellaneous labels and values. They don't come from any particular data source, and the rules for when rows should be suppressed vary. This example has only two columns, but I have other places with more.

    Read the article

  • jQuery validation required( dependency-expression ) only 1 input validating

    - by user331884
    <script type="text/javascript"> $(function () { $("#form1").validate(); $("#survey1 .response").rules("add", { required: function () { return $('#choices').val() != '' } }); }); </script> <form id="form1" runat="server"> <div id="survey1"> <asp:DropDownList ID="choices" runat="server"> <asp:ListItem Value="">--Select--</asp:ListItem> <asp:ListItem>1</asp:ListItem> <asp:ListItem>2</asp:ListItem> </asp:DropDownList> <hr /> Response 1<br /> <asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" Rows="6" CssClass="response"></asp:TextBox> <hr /> Response 2<br /> <asp:TextBox ID="TextBox2" runat="server" TextMode="MultiLine" Rows="6" CssClass="response"></asp:TextBox> </div></form> Only the first textbox gets validated. Am I missing something?

    Read the article

  • ASP.NET AJAX Problem

    - by Rich Andrews
    I've updated some code to use the Ajax Control toolkit 0911 beta and for some reason code that dynamically added collapsable panel extenders in the code behind now causes the following error in the client side jscript... Microsoft JScript runtime error: Sys.ArgumentException: Value must not be null for Controls and Behaviors. Parameter name: element in... $create = Sys.Component.create = function Sys$Component$create(type, properties, events, references, element) { /// <summary locid="M:J#Sys.Component.create" /> /// <param name="type" type="Type"></param> /// <param name="properties" optional="true" mayBeNull="true"></param> /// <param name="events" optional="true" mayBeNull="true"></param> /// <param name="references" optional="true" mayBeNull="true"></param> /// <param name="element" domElement="true" optional="true" mayBeNull="true"></param> /// <returns type="Object"></returns> var e = Function._validateParams(arguments, [ {name: "type", type: Type}, {name: "properties", mayBeNull: true, optional: true}, {name: "events", mayBeNull: true, optional: true}, {name: "references", mayBeNull: true, optional: true}, {name: "element", mayBeNull: true, domElement: true, optional: true} ]); if (e) throw e; if (type.inheritsFrom(Sys.UI.Behavior) || type.inheritsFrom(Sys.UI.Control)) { if (!element) throw Error.argument('element', Sys.Res.createNoDom); } I accept that this is only a beta but I'm unable to either find a work around or even understand the reason why this pretty simple code no longer works. Code private Panel GetReportPanel(DataRow dr, ReportParameter[] Params) { Panel pnlReport = new Panel(); pnlReport.ID = Uri.EscapeDataString(dr["ReportName"].ToString()) + "_MainReportContainer"; //Report Title Section var pnlReportTitle = new Panel(); pnlReportTitle.CssClass = "ReportSectionTitle"; var tblReportTitle = new Table(); var trowReportTitle = new TableRow(); var tcellReportTitle = new TableCell(); var imgReportTitleExpand = new Image(); imgReportTitleExpand.ID = Uri.EscapeDataString("img" + dr["ReportName"].ToString() + "DataExpand"); tcellReportTitle.Controls.Add(imgReportTitleExpand); trowReportTitle.Controls.Add(tcellReportTitle); tcellReportTitle = new TableCell(); var lblReportTitle = new Label(); lblReportTitle.ID = Uri.EscapeDataString("lnk" + dr["ReportName"].ToString()); lblReportTitle.Text = "Functional " + dr["ReportName"].ToString(); tcellReportTitle.Controls.Add(lblReportTitle); trowReportTitle.Controls.Add(tcellReportTitle); tblReportTitle.Controls.Add(trowReportTitle); pnlReportTitle.Controls.Add(tblReportTitle); pnlReport.Controls.Add(pnlReportTitle); //Report Section var pnlReportSection = new Panel(); pnlReportSection.ID = Uri.EscapeDataString("pnlReportSection" + dr["ReportName"].ToString()); pnlReportSection.CssClass = "ReportSection"; pnlReportSection.ScrollBars = ScrollBars.None; var pnlInnerReportSection = new Panel(); pnlInnerReportSection.CssClass = "ReportSection"; var rptControl = new ReportViewer(); rptControl.ID = "rpt" + dr["ReportName"].ToString().Replace(' ', '_'); rptControl.ProcessingMode = ProcessingMode.Remote; rptControl.Width = new Unit("100%"); rptControl.ShowDocumentMapButton = false; rptControl.ShowParameterPrompts = false; rptControl.Visible = true; rptControl.Height = new Unit("500px"); rptControl.AsyncRendering = (bool)dr["ASyncRenderingEnabled"]; rptControl.ServerReport.ReportPath = dr["SSRSReportPath"].ToString(); rptControl.ServerReport.ReportServerUrl = new Uri("http://horoap336/reportserver"); rptControl.ServerReport.SetParameters(Params); pnlInnerReportSection.Controls.Add(rptControl); pnlReportSection.Controls.Add(pnlInnerReportSection); pnlReport.Controls.Add(pnlReportSection); //Collapsable Panel Extender var Extender = new AjaxControlToolkit.CollapsiblePanelExtender(); Extender.TargetControlID = pnlReportSection.ID; Extender.ID = Uri.EscapeDataString(dr["ReportName"].ToString()) + "_Extender"; Extender.CollapsedSize = 0; Extender.Collapsed = true; Extender.ExpandControlID = lblReportTitle.ID; Extender.CollapseControlID = lblReportTitle.ID; Extender.AutoCollapse = false; Extender.AutoExpand = false; Extender.ScrollContents = false; Extender.TextLabelID = lblReportTitle.ID; Extender.CollapsedText = "Functional " + dr["ReportName"].ToString() + " (Click To Show Details...)"; Extender.ExpandedText = "Functional " + dr["ReportName"].ToString() + " (Click To Hide Details...)"; Extender.ImageControlID = imgReportTitleExpand.ID; Extender.ExpandedImage = "~/images/collapse.jpg"; Extender.CollapsedImage = "~/images/expand.jpg"; Extender.ExpandDirection = AjaxControlToolkit.CollapsiblePanelExpandDirection.Vertical; pnlReport.Controls.Add(Extender); return pnlReport; } This panel is then added to a panel in the aspx file using... pnlContainer.Controls.Add(GetReportPanel(dr,Params)); Aspx file... <%@ Page Title="Operations MI Dashboard - Functional Reporting" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="FunctionalReport.aspx.cs" Inherits="TelephonyReport" %> <%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:Panel ID="pnlContainer" runat="server"> </asp:Panel> </asp:Content> So, my questions are: Is there a problem with my code that is only evident in the later version of the toolkit? Does anyone know of a workaround that I can try? Can anyone explain why this problem happens only in the latest version?

    Read the article

  • autopostback problem listbox asp.net

    - by lodun
    I want to add posts(question) like i do that on yahoo answers.When i choose item in "kategorije" control,items can't be loaded in "SUB_kategorije" control. Image My new ascx.cs: 1. protected void Page_Load(object sender, EventArgs e) 2. { 3. 4. 5. if (!Page.IsPostBack) 6. { 7. 8. SqlDataSource ds = new SqlDataSource(); 9. ds.ConnectionString = conn; 10. ds.SelectCommand = "SELECT [ID], [Kategorije] FROM [kategorije] "; 11. kategorije.DataSource = ds; 12. kategorije.DataTextField = "Kategorije"; 13. kategorije.DataValueField = "ID"; 14. kategorije.DataBind(); 15. kategorije.SelectedIndex = 1; 16. 17. SqlDataSource dk = new SqlDataSource(); 18. dk.ConnectionString = conn; 19. dk.SelectCommand = "SELECT * from pod_kategorije WHERE kat_id = " + kategorije.SelectedItem.Value; 20. SUB_kategorije.DataSource = dk; 21. SUB_kategorije.DataTextField = "pkategorija"; 22. SUB_kategorije.DataValueField = "ID"; 23. SUB_kategorije.DataBind(); 24. 25. 26. } 27. 28. 29. 30. 31. } 32. protected void kategorije_SelectedIndexChanged(object sender, EventArgs e) 33. { 34. 35. 36. SqlDataSource dk = new SqlDataSource(); 37. dk.ConnectionString = conn; 38. dk.SelectCommand = "SELECT * from pod_kategorije WHERE [kat_id] = " + kategorije.SelectedItem.Value; 39. SUB_kategorije.DataSource = dk; 40. SUB_kategorije.DataTextField = "pkategorija"; 41. SUB_kategorije.DataValueField = "ID"; 42. SUB_kategorije.DataBind(); 43. 44. 45. } and .ascx: 1. <asp:ListBox ID="kategorije" runat="server" Height="380px" CssClass="kat" AutoPostBack="true" 2. 3. onselectedindexchanged="kategorije_SelectedIndexChanged"></asp:ListBox> 4. 5. <asp:Button ID="Button1" CssClass="posalji" runat="server" Text="click" 6. onclick="Button1_Click" /> 7. 8. 9. 10. <asp:UpdatePanel ID="UpdatePanel10" runat="server"> 11. <ContentTemplate> <asp:ListBox ID="SUB_kategorije" CssClass="pod" Height="150px" runat="server"></asp:ListBox></ContentTemplate> 12. <Triggers> 13. <asp:AsyncPostBackTrigger ControlID="kategorije" EventName="SelectedIndexChanged" /> 14. 15. </Triggers> 16. 17. </asp:UpdatePanel>

    Read the article

  • how to find datakeys in oncheckedchanged event ?

    - by subodh
    <asp:Panel ID="pnlFocusAreaPanel" runat="server" GroupingText="Focus Area" Width="800"> <table cellspacing="0" cellpadding="0" width="750"> <tr> <td> <asp:GridView ID="dgFocusAreaDetails" runat="server" Width="100%" CssClass="dgStyle" AutoGenerateColumns="False" BorderColor="Silver" BorderWidth="1px" CellPadding="0" ShowHeader="False" OnSelectedIndexChanged="dgFocusAreaDetails_SelectedIndexChanged" DataKeyNames="PK_ID"> <FooterStyle Font-Underline="True" HorizontalAlign="Center" VerticalAlign="Middle"> </FooterStyle> <Columns> <asp:TemplateField HeaderText="Focus Area" HeaderStyle-BackColor="Silver"> <ItemStyle Width="90%" /> <ItemTemplate> <asp:Label runat="server" ID="lblFocusArea" Text='<%# DataBinder.Eval(Container.DataItem, "FOCUS_AREA_NAME").ToString()%>'> </asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Is Current Valid" HeaderStyle-BackColor="Silver"> <ItemStyle Width="10%" HorizontalAlign="Center" /> <ItemTemplate> <asp:CheckBox ID="chkFocusArea" runat="server" OnCheckedChanged="OnCheckChangedEvent" AutoPostBack="true" /> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> </td> </tr> <tr> <td align="left"> <asp:TextBox ID="txtFocusArea" runat="server" Width="300px" CausesValidation="true" CssClass="txtStyle" ValidationGroup="focusArea"> </asp:TextBox> <cc1:TextBoxWatermarkExtender ID="txtFocusAreaWaterMark" runat="server" TargetControlID="txtFocusArea" WatermarkText="Add Focus Area" WatermarkCssClass="WaterMarkStyle"> </cc1:TextBoxWatermarkExtender> <asp:Button ID="btnAddFocusArea" runat="server" Text="AddFocusArea" CssClass="btnStyle" OnClick="btnAddFocusArea_Click" CausesValidation="true" ValidationGroup="focusArea" /> <asp:RequiredFieldValidator ID="reqtxtFocusArea" runat="server" ControlToValidate="txtFocusArea" ErrorMessage="Please enter focus area" Display="Dynamic" ValidationGroup="focusArea"> </asp:RequiredFieldValidator> <asp:RegularExpressionValidator ID="regexFocusArea" runat="server" ErrorMessage="Invalid characters(<,>,#)" ControlToValidate="txtFocusArea" ValidationExpression="^([^&lt;#&gt;]*)$" ValidationGroup="focusArea" Display="Dynamic" SetFocusOnError="true"> </asp:RegularExpressionValidator> </td> </tr> </table> </asp:Panel> and in code behind protected void btnAddFocusArea_Click(object sender, EventArgs e) { string strFocusArea = txtFocusArea.Text; OleDbConnection myConnection = new OleDbConnection(ConfigurationSettings.AppSettings["SQLConnectionString"]); if (strFocusArea == string.Empty || strFocusArea == txtFocusAreaWaterMark.WatermarkText) { lblError.Text = "Focus area is not entered"; } else { string insertQuery = "INSERT INTO LK_CODECAT_FOCUS_AREA(FOCUS_AREA_NAME,FK_ADDED_BY,ADDED_ON) "+ " VALUES('" + strFocusArea + "', "+Session["UserID"] +", GETDATE())"; try { myConnection.Open(); OleDbCommand myCommandToInsert = new OleDbCommand(insertQuery, myConnection); myCommandToInsert.ExecuteNonQuery(); } catch(Exception exc) { ExceptionLogger.LogException(exc); } finally { if (myConnection != null) { myConnection.Close(); } } PopulateFocusArea(); } txtFocusArea.Text = txtFocusAreaWaterMark.WatermarkText; } private void PopulateFocusArea() { OleDbConnection myConnection = new OleDbConnection(ConfigurationSettings.AppSettings["SQLConnectionString"]); string selectQuery = "SELECT PK_ID, FOCUS_AREA_NAME, IS_CURRENT_FOCUS FROM LK_CODECAT_FOCUS_AREA LKCFA ORDER BY FOCUS_AREA_NAME"; if (Session["RoleID"].ToString() == "1" || ((Session["WorkID"].ToString() != "9") || (Session["WorkID2"].ToString() != "9") || (Session["WorkID3"].ToString() != "9"))) { try { myConnection.Open(); OleDbCommand myCommandFocusArea = new OleDbCommand(selectQuery, myConnection); OleDbDataAdapter myAdapter = new OleDbDataAdapter(myCommandFocusArea); DataSet ds = new DataSet(); myAdapter.Fill(ds); dgFocusAreaDetails.DataSource = ds; dgFocusAreaDetails.ShowHeader = true; dgFocusAreaDetails.DataBind(); } catch (Exception exc) { ExceptionLogger.LogException(exc); } finally { if (myConnection != null) { myConnection.Close(); } } } } protected void dgFocusAreaDetails_SelectedIndexChanged(object sender, EventArgs e) { string selectedCategory = dgFocusAreaDetails.SelectedRow.Cells[1].Text; int index = dgFocusAreaDetails.SelectedIndex; lblError.Text = dgFocusAreaDetails.DataKeys[index].Value.ToString(); } public void OnCheckChangedEvent(object sender, EventArgs e) { CheckBox chk = (CheckBox)sender; string chkfocusarea = ((Control)chk).ID; //string focusAreaDetails = dgFocusAreaDetails.SelectedRow.Cells[0].Text; int index =Convert.ToInt32(dgFocusAreaDetails.SelectedIndex); if (chk.Checked) { string updateQuery = "UPDATE [LK_CODECAT_FOCUS_AREA] SET [IS_CURRENT_FOCUS] = 1 WHERE PK_ID = " +Convert.ToInt32( dgFocusAreaDetails.DataKeys[index].Value)+" "; } else { lblError.Text = "unchecked"; } } i want to know how i find the datakeyvalue on checked event.

    Read the article

  • How to retrieve ID of button clicked within usercontrol on Asp.net page?

    - by Shawn Gilligan
    I have a page that I am working on that I'm linking multiple user controls to. The user control contains 3 buttons, an attach, clear and view button. When a user clicks on any control on the page, the resulting information is "dumped" into the last visible control on the page. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" MasterPageFile="DefaultPage.master" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %> <%@ Register tagName="FileHandler" src="FileHandling.ascx" tagPrefix="ucFile" %> <asp:Content ID="Content1" ContentPlaceHolderID="Main" Runat="Server"> <asp:UpdatePanel ID="upPanel" UpdateMode="Conditional" runat="server"> <ContentTemplate> <table> <tr> <td> <ucFile:FileHandler ID="fFile1" runat="server" /> </td> <td> <ucFile:FileHandler ID="fFile2" runat="server" /> </td> </tr> </table> </ContentTemplate> </asp:UpdatePanel> </asp:Content> All file handling and processing is handled within the control, with an event when the upload to the file server is complete via a file name that was generated. When either button is clicked, the file name is always stored internal to the control in the last control's text box. Control code: <table style="width: 50%;"> <tr style="white-space: nowrap;"> <td style="width: 1%;"> <asp:Label runat="server" ID="lblFile" /> </td> <td style="width: 20%;"> <asp:TextBox ID="txtFile" CssClass="backColor" runat="server" OnTextChanged="FileInformationChanged" /> </td> <td style="width: 1%"> <%--<asp:Button runat="server" ID="btnUpload" CssClass="btn" Text="Attach" OnClick="UploadFile"/>--%> <input type="button" id="btnUpload" class="btn" tabindex="30" value="Attach" onclick="SetupUpload();" /> </td> <td style="width: 1%"> <%--<asp:Button runat="server" ID="btnClear" Text="Clear" CssClass="btn" OnClick="ClearTextValue"/>--%> <input type="button" id="btnClearFile" class="btn" value="Clear" onclick="document.getElementById('<%=txtFile.ClientID%>').value = '';document.getElementById('<%=hfFile.ClientID%>').value = '';" /> </td> <td style="width: 1%"> <a href="#here" onclick="ViewLink(document.getElementById('<%=hfFile.ClientID%>').value, '')">View</a> </td> <td style="width: 1%"> <asp:HiddenField ID="hfFile" runat="server" /> </td> </tr> </table> <script type="text/javascript"> var ItemPath = ""; function SetupUpload(File) { ItemPath = File; VersionAttach('<%=UploadPath%>', 'true'); } function UploadComplete(File) { document.getElementById('<%=txtFile.ClientID%>').value = File.substring(File.lastIndexOf("/") + 1); document.getElementById('<%=hfFile.ClientID%>').value = File; alert('<%=txtFile.Text %>'); alert('<%=ClientID %>') } function ViewLink(File, Alert) { if (File != "") { if (File.indexOf("../data/") != -1) { window.open(File, '_blank'); } else { window.open('../data/<%=UploadPath%>/' + File, '_blank'); } } else if (Alert == "") { alert('No file has been uploaded for this field.'); } } </script>

    Read the article

  • Lazy HTML attributes wrapping in Internet Explorer

    - by AGS777
    Having encountered this Internet Explorer (all versions) behavior several times previously, I eventually decided to share this most probably useless knowledge. Excuse my lengthy explanations because I am going to show the behavior along with a very simple case when one can come across it inadvertently. Let's say I want to implement some simple templating solution in JavaScript. I wrote an HTML template with an intention to bind data to it on the client side: Please note, that name of the “sys-template” class is just a coincidence. I do not use any ASP.NET AJAX code in this simple example. As you can see we need to replace placeholders (property name wrapped with curly braces) with actual data. Also, as you can see, many of the placeholders are situated within attribute values and it is where the danger lies. I am going to use <a /> element HTML as a template and replace each placeholder pattern with respective properties’ values with a little bit of jQuery like this: You can find complete code along with the contextFormat() method definition at the end of the post. Let’s assume that value for the name property (that we want to put in the title attribute) of the first data item is “first tooltip”. So it consists of two words. When the replacement occurred, title attribute should contain the “first tooltip” text which we are going to see as a tooltip for the <a /> element. But let’s run the sample code in Internet Explorer and check it out. What you’ll see is that only the first word of the supposed “title” attribute’s content is shown. So, were is the rest of my attribute and what happened? The answer is obvious once you see the result of jQuery(“.sys-template”).html() line for the given HTML markup. In IE you’ll get the following <A id={id} class={cssClass} title={name} href="{source}" myAttr="{attr}">Link to {source}</A> See any difference between this HTML and the one shown earlier? No? Then look carefully. While the original HTML of the <a /> element is well-formed and all the attributes are correctly quoted, when you take the same HTML back in Internet Explorer (it doesn’t matter whether you use html() method from jQuery library or IE’s innerHTML directly), you lose attributes’ quotes for some of the attributes. Then, after replacement, we’ll get following HTML for our first data item. I marked the attribute value in question with italic: <A id=1 class=first title=first tooltip href="first.html" myAttr="firstAttr">Link to first.html</A> Now you can easily imagine for yourself what happens when this HTML is inserted into the document and why we do not see the second (and any subsequent words if any) of our title attribute in the tooltip. There are still two important things to note. The first one (and it actually the reason why I named the post “lazy wrapping” is that if value of the HTML attribute does contains spaces in the original HTML, then it WILL be wrapped with quotation marks. For example, if I wrote following on my page (note the trailing space for the title attribute value) <a href="{source}" title="{name}  " id="{id}" myAttr="{attr}" class="{cssClass}">Link to {source}</a> then I would have my placeholder quoted correctly and the result of the replacement would render as expected: The second important thing to note is that there are exceptions for the lazy attributes wrapping rule in IE. As you can see href attribute value did not contain spaces exactly as all the other attributes with placeholders, but it was still returned correctly quoted Custom attribute myAttr is also quoted correctly when returned back from document, though its placeholder value does not contain spaces either. Now, on account of the highly unlikely probability that you found this information useful and need a solution to the problem the aforementioned behavior introduces for Internet Explorer browser, I can suggest a simple workaround – manually quote the mischievous attributes prior the placeholder pattern is replaced. Using the code of contextFormat() method shown below, you would need to add following line right before the return statement: result = result.replace(/=({([^}]+)})/g, '="$1"'); Below please find original sample code:

    Read the article

  • jquery masked input with asp.net control problem

    - by Eyla
    Hi, I have problem while using jquery maskedinput with asp.net textbox. I have a check box that when I check will set a mask to the textbox and when uncheck it change the mask. the problem that when the focus is lost before the mask completed to be filled the text box will empty. how can I fix the problem??? here is my code: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> <script src="js/jquery-1.4.1.js" type="text/javascript"></script> <script src="js/jquery.maskedinput-1.2.2.js" type="text/javascript"></script> <script type="text/javascript"> function mycheck() { if ($('#<%=chk.ClientID %>').is(':checked')) { $("#<%=txt.ClientID %>").unmask(); $("#<%=txt.ClientID %>").val(""); $("#<%=txt.ClientID %>").mask("999999999999"); } else { $("#<%=txt.ClientID %>").unmask(); $("#<%=txt.ClientID %>").val(""); $("#<%=txt.ClientID %>").mask("(999)999-9999"); } } </script> <style type="text/css"> #form1 { margin-top: 0px; } </style> </head> <body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <div> <p> <asp:CheckBox ID="chk" runat="server" CssClass="kk" onclick="mycheck()" /> </p> <p> <asp:TextBox ID="txt" runat="server" CssClass="tt" ></asp:TextBox> </p> </div> </form> </body> </html>

    Read the article

  • AjaxControlToolkit DropDownExtender inside a table always displays associated panel

    - by Amanda Myer
    I have a textarea that has the ajaxcontroltoolkit dropdownextender associated with it, and a panel that contains a gridview with the options for the user to select from. Here is the code for these items: <asp:UpdatePanel ID="updPnlView" UpdateMode="Conditional" runat="server"> <ContentTemplate> <asp:TextBox ID="txtSiteName" runat="server" TextMode="MultiLine" Rows="4" Columns="33" ReadOnly="true" /></td> <ajaxToolkit:DropDownExtender runat="server" ID="popupdropdown" DropDownControlID="pnlGrid" TargetControlID="txtSiteName" /> <asp:Panel runat="server" ID="pnlGrid" Style="display: none; visibility: hidden" Height="300" ScrollBars="Vertical"> <asp:GridView ID="gvSite" runat="server" AutoGenerateColumns="False" Width="100%" DataKeyNames="ID,FullAddress" DataSourceID="odsSite" OnRowDataBound="gvSite_RowDataBound" ShowFooter="false" ShowHeader="false" OnSelectedIndexChanged="gvSite_SelectedIndexChanged" > <Columns> <asp:CommandField ButtonType="Link" SelectText="Select" ShowSelectButton="true" ItemStyle-CssClass="HiddenColumn" /> <asp:TemplateField > <ItemTemplate> <asp:Label ID="FullAddress" runat="server" Text='<%# Eval("FullAddress").ToString().Replace("\n", "<br/>") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:CheckBoxField DataField="DisabledFLG" ItemStyle-CssClass="HiddenColumn" /> </Columns> </asp:GridView> </asp:Panel> <asp:ObjectDataSource ID="odsSite" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetList" TypeName="SOM.DCO.MOGWAI.Bll.SiteManager" onselecting="odsSite_Selecting" SortParameterName="SortExpression" onselected="odsSite_Selected" > <SelectParameters> <asp:Parameter Name="myCriteria" Type="Object" /> <asp:Parameter Name="myIDs" Type="Object" /> <asp:Parameter Name="sortExpression" Type="String" /> <asp:Parameter Name="bypassCache" Type="Boolean" /> </SelectParameters> </asp:ObjectDataSource> </ContentTemplate> </asp:UpdatePanel> When I place this item inside a table (i.e. <table><tr><td>THE CODE ABOVE</td></tr></table>) the panel always shows completely open never hidden. It also completely fills out the available space within the TD and pushes all other text on the page down the screen. If I take the associated controls out of the table, it works as expected. I have duplicated this issue in both Firefox and IE8. What gives?

    Read the article

  • ASP.NET panel DefaultButton event fires only once?

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

    Read the article

  • Eval ID on radiobutton in Datalist

    - by ravi
    my code gota datalist with radio button and iv made it single selectable onitemdatabound....now im trying to evaluate a hiddenfield on basis of selected radio button my code goes like this aspx code <asp:DataList ID="DataList1" runat="server" RepeatColumns = "4" CssClass="datalist1" RepeatLayout = "Table" OnItemDataBound="SOMENAMEItemBound" CellSpacing="20" onselectedindexchanged="DataList1_SelectedIndexChanged"> <ItemTemplate> <br /> <table cellpadding = "5px" cellspacing = "0" class="dlTable"> <tr> <td align="center"> <a href="<%#Eval("FilePath")%>" target="_blank"><asp:Image ID="Image1" runat="server" CssClass="imu" ImageUrl = '<%# Eval("FilePath")%>' Width = "100px" Height = "100px" style ="cursor:pointer" /> </td> </tr> <tr > <td align="center"> <asp:RadioButton ID="rdb" runat="server" OnCheckedChanged="rdb_click" AutoPostBack="True" /> <asp:HiddenField ID="HiddenField1" runat="server" Value = '<%#Eval("ID")%>' /> </td> </tr> </table> </ItemTemplate> </asp:DataList> code behind protected void SOMENAMEItemBound(object sender, DataListItemEventArgs e) { RadioButton rdb; rdb = (RadioButton)e.Item.FindControl("rdb"); if (rdb != null) rdb.Attributes.Add("onclick", "CheckOnes(this);"); } protected void rdb_click(object sender, EventArgs e) { for (int i = 0; i < DataList1.Items.Count; i++) { RadioButton rdb; rdb = (RadioButton)DataList1.Items[i].FindControl("rdb"); if (rdb != null) { if (rdb.Checked) { HiddenField hf = (HiddenField)DataList1.Items[i].FindControl("HiddenField1"); Response.Write(hf.Value); } } } } the javascript im using... function CheckOnes(spanChk){ var oItem = spanChk.children; var theBox= (spanChk.type=="radio") ? spanChk : spanChk.children.item[0]; xState=theBox.unchecked; elm=theBox.form.elements; for(i=0;i<elm.length;i++) if(elm[i].type=="radio" && elm[i].id!=theBox.id) { elm[i].checked=xState; } } iam getting an error like this Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. Details: Error parsing near 'pload Demonstration|'. is there any other way to do this or can nyone plz help to get rid of this problem

    Read the article

  • LinkButton Click event ignored

    - by Craig
    I have the following Hyperlink as a button:- <asp:LinkButton ID="loginButton" runat="server" CssClass="loginButton" Text="LOGIN" OnClientClick="return validateLogin(memNoID,pwID)" AddressOf="loginButton.Click"></asp:LinkButton> It causes a postback but only executes the onload and prerender sections of code. It totally ignores the following function signature:- Protected Sub loginButton_Click(ByVal sender As Object, ByVal e As EventArgs) Some code End Sub Any pointers appreciated.

    Read the article

  • Spring validation errors not displayed

    - by Art Vandelay
    I have the following situation. I have a validator to validate my command object and set the errors on a Errors object to be displayed in my form. The validator is invoked as expected and works okay, but the errors i set on the Errors objects are not displayed, when i am sent back to my form because of the validation errors. Validator: public void validate(Object obj, Errors err) { MyCommand myCommand = (MyCommand) obj; int index = 0; for (Field field : myCommand.getFields()) { if (field.isChecked()) { if ((field.getValue() == null) || (field.getValue().equals(""))) { err.rejectValue("fields[" + index + "].value", "errors.missing"); } } index++; } if (myCommand.getLimit() < 0) { err.rejectValue("limit", "errors.invalid"); } } Command: public class MyCommand { private List<Field> fields; private int limit; //getters and setters } public class Field { private boolean checked; private String name; private String value; //getters and setters } Form: <form:form id="myForm" method="POST" action="${url}" commandName="myCommand"> <c:forEach items="${myCommand.fields}" var="field" varStatus="status"> <form:checkbox path="fields[${status.index}].checked" value="${field.checked}" /> <c:out value="${field.name}" /> <form:input path="fields[${status.index}].value" /> <form:errors path="fields[${status.index}].value" cssClass="error" /></td> <form:hidden path="fields[${status.index}].name" /> </c:forEach> <fmt:message key="label.limit" /> <form:input path="limit" /> <form:errors path="limit" cssClass="error" /> </form:form> Controller: @RequestMapping(value = REQ_MAPPING, method = RequestMethod.POST) public String onSubmit(Model model, MyCommand myCommand, BindingResult result) { // validate myCommandValidator.validate(myCommand, result); if (result.hasErrors()) { model.addAttribute("myCommand", myCommand); return VIEW; } // form is okay, do stuff and redirect } Could it be that the paths i give in the validator and tag are not correct? The validator validates a command object containing a list of objects, so that's why i give a index on the list in the command object when registering an error message (for example: "fields["+index+"]".value). Or is it that the Errors object containing the errors is not available to my view? Any help is welcome and appreciated, it might give me a hint or point me in right direction.

    Read the article

  • Problem wth paging ObjectDataSource

    - by funky
    asp page code: <asp:ObjectDataSource runat="server" ID="odsResults" OnSelecting="odsResults_Selecting" /> <tr><td> <wssawc:SPGridViewPager ID="sgvpPagerTop" runat="server" GridViewId="sgvConversionResults" /> </td></tr> <tr> <td colspan="2" class="ms-vb"> <wssawc:SPGridView runat="server" ID="sgvConversionResults" AutoGenerateColumns="false" RowStyle-CssClass="" AlternatingRowStyle-CssClass="ms-alternating" /> </td> </tr> Class code: public partial class Convert : System.Web.UI.Page { ... private DataTable resultDataSource = new DataTable(); ... protected void Page_Init(object sender, EventArgs e) { ... resultDataSource.Columns.Add("Column1"); resultDataSource.Columns.Add("Column2"); resultDataSource.Columns.Add("Column3"); resultDataSource.Columns.Add("Column4"); ... odsResults.TypeName = GetType().AssemblyQualifiedName; odsResults.SelectMethod = "SelectData"; odsResults.SelectCountMethod = "GetRecordCount"; odsResults.EnablePaging = true; sgvConversionResults.DataSourceID = odsResults.ID; ConversionResultsCreateColumns(); sgvConversionResults.AllowPaging = true; ... } protected void btnBTN_Click(object sender, EventArgs e) { // add rows into resultDataSource } public DataTable SelectData(DataTable ds,int startRowIndex,int maximumRows) { DataTable dt = new DataTable(); dt.Columns.Add("Column1"); dt.Columns.Add("Column2"); dt.Columns.Add("Column3"); dt.Columns.Add("Column4"); for (int i =startRowIndex; i<startRowIndex+10 ;i++) { if (i<ds.Rows.Count) { dt.Rows.Add(ds.Rows[i][0].ToString(), ds.Rows[i][1].ToString(), ds.Rows[i][2].ToString(), ds.Rows[i][3].ToString()); } } return dt; } public int GetRecordCount(DataTable ds) { return ds.Rows.Count; } protected void odsResults_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) { e.InputParameters["ds"] = resultDataSource; } } On click BTN button resultDataSource receive some rows. Page reload and we can see result in sgvConversionResults. First 10 rows. But after click next page in pager we have message "There are no items to show in this view". When I try debug I find that after postBack page (on click next page) input params "ds" is blank, ds.Rows.Count = 0 and etc... As though resultDataSource became empty(( What do I do not correctly?. Sorry my English.

    Read the article

  • Design time error - multiple controls with the same Id

    - by ilivewithian
    I'm using VS 2008, I have a very simple page that has a bunch of uniquely named controls. When I try to view it in design mode I get the following error: Error Rendering Control - Label12 An unhanded exception has occurred. Multiple controls with the same ID 'Label1' were found. FindControl requires that controls have unique IDs I've checked the HTML and the designer file and I can only see one control called Label1. What might be causing this? Also, here is the aspx markup I'm having trouble with? <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="CoachingAppearanceReport.aspx.vb" Inherits="AcademyPro.CoachingAppearanceReport" %> <!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:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <div id="appearanceDetail" class="Left CriteriaContainer"> <asp:Label ID="Label1" runat="server" Text="Appearance Type" AssociatedControlID="ddlAppearanceType" /> <asp:DropDownList ID="ddlAppearanceType" runat="server" CssClass="AppType" OnDataBound="ddlAppearanceType_DataBound" DataSourceID="odsAppearanceType" DataTextField="AppearanceType" DataValueField="AppearanceTypeCode"> </asp:DropDownList> <asp:RequiredFieldValidator ID="rfvAppearanceType" runat="server" ControlToValidate="ddlAppearanceType" InitialValue="" Text="*" ErrorMessage="The appearance type must be selected" /> <asp:Label ID="lblAppearanceType" runat="server" /> <br /> <div class="SubSettings"> <asp:Label ID="Label12" runat="server" Text="Subbed for" AssociatedControlID="ddlSubbedFor" /> <asp:DropDownList ID="ddlSubbedFor" runat="server" OnDataBound="ddlSubbedFor_DataBound" DataSourceID="odsPlayersInAgeGroup" DataTextField="PlayerName" DataValueField="PlayerID"> </asp:DropDownList> <asp:Label ID="lblSubbedFor" runat="server" /> <br /> <asp:Label ID="Label13" runat="server" Text="Mins" AssociatedControlID="txtSubMins" /> <asp:TextBox ID="txtSubMins" runat="server" MaxLength="3" CssClass="TinyWidth" /> <asp:Label ID="lblSubMins" runat="server" /> </div> </div> </ContentTemplate> </asp:UpdatePanel> </form> </body> </html>

    Read the article

  • ASP.NET-C#: Inserting const into TextBox in Gridview

    - by dash
    I have some problems inserting a const "1" into a textbox which is gridviw. the gridview code: <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" EnableViewState="False"> <Columns> <asp:BoundField DataField="Price" HeaderText="Price" ItemStyle-CssClass="price" > <ItemStyle CssClass="price"></ItemStyle> </asp:BoundField> <asp:TemplateField HeaderText="ProductID"> <ItemTemplate> <asp:Label ID="lblID" runat="server" Text='<%# Eval("ProductID") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="ProductName"> <ItemTemplate> <asp:Label ID="lblName" runat="server" Text='<%# Eval("ProductName") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Summary"> <ItemTemplate> <asp:Label ID="lblSum" runat="server" Text='<%# Eval("Summary") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="picPath"> <ItemTemplate> <asp:Label ID="lblPic" runat="server" Text='<%# Eval("picPath") %>' ></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText = "quantity"> <ItemTemplate> <asp:TextBox ID="lblquantity" runat="server" ></asp:TextBox> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText = "Total"> <ItemTemplate> <asp:Label ID="lblTotal" runat="server" ></asp:Label> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> All the information is populated from the session of the privious page, beside this textbox which doesnt comes from anywhere, its a quantity textbox which the user should enter. and i want it to have a defalt value of "1". I dont actually know how to insert into a textbox which is in the gridview. please help me. thanx

    Read the article

  • VB - Convert Web Site to Web Application

    - by Dave
    Hi This is my first time doing VB :-) I've inherited a web site, which I've converted into a web application in VS2008. The conversion has worked for everything except a Gallery control. The compile error I'm getting is: Type 'Gallery' is not defined in file: gallery_oct07.aspx.designer.vb Option Strict On Option Explicit On Partial Public Class gallery_oct07 '''<summary> '''Gallery1 control. '''</summary> '''<remarks> '''Auto-generated field. '''To modify move field declaration from designer file to code-behind file. '''</remarks> Protected WithEvents Gallery1 As Global.Gallery End Class with squiggly lines under Global.Gallery. The gallery_oct07.aspx.vb is: Partial Class gallery_oct07 Inherits System.Web.UI.Page End Class Gallery.ascx is: <%@ Control Language="C#" AutoEventWireup="true" Codebehind="Gallery.ascx.cs" Inherits="WebApplication1.Gallery"%> <asp:Repeater runat="server" ID="rptGallery"> <HeaderTemplate> <ul class='<%#CssClass%>'> </HeaderTemplate> <ItemTemplate> <li><a href='<%#ImageFolder + Eval("Name") %>' class="thickbox" rel="gallery"><img src='<%#ImageFolder + "thumb/" + Eval("Name") %>' /></a></li> </ItemTemplate> <FooterTemplate> </ul></FooterTemplate> </asp:Repeater> and the code behind is: using System; using System.IO; namespace WebApplication1 { public partial class Gallery : System.Web.UI.UserControl { public string _ImageFolder; public string ImageFolder { get { return _ImageFolder; } set { _ImageFolder = value; } } private string _cssClass = "gallery"; public string CssClass { get { return _cssClass; } set { _cssClass = value; } } protected void Page_Load(object sender, EventArgs e) { DirectoryInfo dir = new DirectoryInfo(MapPath(ImageFolder)); FileInfo[] images = dir.GetFiles("*.jpg"); rptGallery.DataSource = images; rptGallery.DataBind(); } protected void Page_PreRender(object sender, EventArgs e) { } } } The feels like a namespace issue.. My project namespace is WebApplication1. Cheers!

    Read the article

  • link button property to open in new tab?

    - by Surya sasidhar
    hi, in my application i have some link buttons there but when i right click on them i not(they are in disable mode) found property open in new tab or open in new window, what is that property can u help me. thank you <asp:LinkButton id="lbnkVidTtile1" runat="Server" CssClass="bodytext" Text='<%# Eval("newvideotitle") %>' ></LinkButton>

    Read the article

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