Error in javascript functionSKShradha Kale12yAsked Sep 29, 2014, 11:42 PM2.8kJSP0x800a138f - JavaScript runtime error: Unable to get property 'value' of undefined or null reference in asp.net web application application
Saineshwar Bageri12y agoPosted Oct 1, 2014, 1:41 AMAccepted answerthis works Mark as Answer if i help you
AParun prasath12y agoPosted Oct 6, 2014, 4:12 AMInstead of getting control with dynamic name.Simply make it ClientIdMode="Static" in your textbox control.this will fix your problem..Beware of this will create some ajax issues.
SKShradha Kale12y agoPosted Oct 1, 2014, 1:28 AM<%@ Page Title="" Language="C#" MasterPageFile="~/frmMain.Master" AutoEventWireup="true" CodeBehind="Frm_Inv_Store.aspx.cs" Inherits="Trial_Demo.WebForm7" EnableEventValidation="false" %><%-- --%> .style13 { width: 100%; height: 433px; } .style20 { height: 39px; } .style21 { height: 30px; } .style28 { width: 102px; height: 58px; } .style29 { width: 22px; height: 58px; } .style30 { width: 239px; height: 58px; } .style32 { width: 14px; height: 58px; } .style33 { height: 58px; } .style34 { width: 102px; height: 17px; } .style35 { width: 22px; height: 17px; } .style36 { width: 239px; height: 17px; } .style37 { width: 152px; height: 17px; } .style38 { width: 14px; height: 17px; } .style39 { width: 102px; height: 39px; } .style40 { width: 22px; height: 39px; } .style41 { width: 239px; height: 39px; } .style42 { width: 152px; height: 39px; } .style43 { width: 14px; height: 39px; } .style44 { height: 48px; } .style45 { width: 102px; height: 32px; } .style46 { width: 22px; height: 32px; } .style47 { width: 239px; height: 32px; } .style48 { width: 102px; height: 32px; } .style49 { width: 14px; height: 32px; } .Grid { background-color: #fff; margin: 5px 0 10px 0; border: solid 1px #525252; border-collapse: collapse; font-family: Calibri; color: #474747; } .Grid th { padding: 4px 2px; color: #fff; background: #363670 url('http://localhost/Images/grid-header.png') repeat-x 50% top; border-left: solid 1px #525252; font-size: 0.9em; } .Grid .alt { background: #fcfcfc url('http://localhost/Images/grid-alt.png') repeat-x 50% top; } .Grid .pgr { background: url('') repeat-x 50% top; } .style50 { height: 17px; } ID="Menu1" runat="server" BackColor="#3333CC" Font-Bold="True" Font-Names="cambria" Font-Size="Medium" ForeColor="White" Height="30px" ItemWrap="true" Orientation="Horizontal" Width="100%"> VerticalPadding="8px" /> <%# Eval("Text") %> BorderWidth="3px" Font-Names="cambria" Font-Size="Medium" ForeColor="White" Height="30px" ItemSpacing="2px" Width="200px" /> Text="Material Request" Value="Material Request"> Text="Material Issue" Value="Material Issue"> Text="Material Rejection" Value="Material Rejection"> Text="Product Request" Value="Product Request"> Text="Product Issue" Value="Product Issue"> Text="Production Rejection" Value="Production Rejection"> Value="Store"> Text="Safety Stock" Value="Safety Stock"> Text="Stock In" Value="Stock In"> Text="Safety Stock Report" Value="Safety Stock Report"> Text="Material Issue Report" Value="New Item"> Text="Material Request Report" Value="New Item"> Text="Material Rejection Report" Value="New Item"> Text="Product Issue Report" Value="Product Issue Report"> Text="Product Request Report" Value="New Item"> Text="Product Rejection Report" Value="New Item"> style="background-color: #1C72C6; font-family: cambria; font-size: medium; font-weight: bolder; font-style: normal; color: #FFFFFF; text-align: center;">Store Details style="border-width: 1px; border-color: #000099; text-align: left; font-family: cambria; font-size: smaller; font-weight: bolder; font-style: normal; color: #CC0000; border-bottom-style: solid;" valign="middle"> ImageUrl="~/Images/download.jpg" ToolTip="Save" Width="20px" OnClientClick="return userValid();" OnClick="Ibtn_Inv_Save_Click" /> runat="server" Height="21px" ImageUrl="~/Images/Delete.jpg" ToolTip="Delete" Width="28px" OnClientClick="javascript:return confirm('Are you sure?');" OnClick="btn_Inv_Delete_Click" /> ImageUrl="~/Images/Print.jpg" ToolTip="Print" Width="18px" /> runat="server" Height="23px" ImageUrl="~/Images/1407938011_arrow_refresh.png" ToolTip="Refresh" OnClientClick="javascript:return confirm('Are you sure?');" Width="20px" OnClick="btn_Inv_Refresh_Click" /> runat="server" Height="20px" ImageUrl="~/Images/Close.jpg" ToolTip="Exit" Width="22px" OnClientClick="javascript:return confirm('Are you sure?');" OnClick="btn_Inv_Exit_Click" /> * Indicate Mandatory Fields Width="69px"> ImageUrl="~/Images/1407938052_search-b.png" ToolTip="Search" Width="20px" OnClick="btn_Inv_Search_Click" /> style="color: #003399; font-size: medium; text-align: inherit;" valign="top"> Store Name BorderStyle="Solid" BorderWidth="1px" Width="177px"> style="color: #003399; font-size: medium; text-align: inherit;" valign="top"> Status Active InActive style="color: #003399; font-size: medium; text-align: inherit;" valign="top"> Descripion BorderStyle="Solid" BorderWidth="1px" Height="40px" Width="235px" TextMode="MultiLine"> style="color: #003399; font-size: medium; text-align: inherit;" valign="top">Remark BorderStyle="Solid" BorderWidth="1px" Height="40px" Width="235px" TextMode="MultiLine"> style="color: #003399; font-size: medium; text-align: inherit;" valign="top"> Location BorderStyle="Solid" BorderWidth="1px" Width="177px"> style="color: #003399; font-size: medium; text-align: inherit;" valign="top">Entry Date BorderStyle="Solid" BorderWidth="1px" ReadOnly="True"> ImageUrl="~/Images/sxsda.jpg" ToolTip="Select Date" Width="20px" OnClick="IBtn_Inv_Cal_Click" /> DayNameFormat="Shortest" Font-Names="Times New Roman" Font-Size="10pt" ForeColor="Black" Height="158px" NextPrevFormat="FullMonth" Style="margin-left: 72px" TitleFormat="Month" Visible="False" Width="182px" OnSelectionChanged="calDate_SelectionChanged"> ForeColor="#333333" Height="10pt" /> Font-Size="8pt" ForeColor="#333333" Width="1%" /> ForeColor="White" Height="14pt" /> style="color: #003399; font-size: medium; text-align: inherit;" valign="middle"> style="border-style: ridge; border-width: 1px; border-color: #000099; color: #000099; font-size: small; text-align: left; font-family: Cambria; font-weight: bolder; font-style: normal; padding-right: 10px; padding-left: 35px; overflow: scroll; padding-top: 10px; vertical-align: text-top;" colspan="6"> Search Details AlternatingRowStyle-CssClass="alt" AutoGenerateColumns="false" CssClass="Grid" Height="104px" PagerStyle-CssClass="pgr" PageSize="6" Width="427px" OnRowDataBound="dgv_Inv_StoreView_RowDataBound"> Saineshwar Bageri12y agoPosted Oct 1, 2014, 1:23 AM you are using inside Update panel please paste Design code ...SKShradha Kale12y agoPosted Oct 1, 2014, 1:22 AMin above code even if the textbox are not null it shows nullSaineshwar Bageri12y agoPosted Oct 1, 2014, 1:15 AMtried this var StoreName= document.getElementById('<%=txt_Inv_StoreName.ClientID%>');SKShradha Kale12y agoPosted Oct 1, 2014, 1:13 AMI even tried this but it dosen't solve my problem..I want to check whether the textbox is are empty or not.Saineshwar Bageri12y agoPosted Oct 1, 2014, 1:09 AMSample checkThe error is here: var fdate = document.getElementById('txtFromDate'); var edate = document.getElementById('txtToDate');The problem is that txtFromDate and txtToDate are the server name of controls, not the client name (look the source of page from the browser).Try this: var fdate = document.getElementById('<%=txtFromDate.ClientID%>'); var edate = document.getElementById('<%=txtToDate.ClientID%>');SKShradha Kale12y agoPosted Oct 1, 2014, 1:07 AMgetting error while calling function from ajax enabled content page.Saineshwar Bageri12y agoPosted Sep 30, 2014, 12:10 AM Post your Javascript function please
Saineshwar Bageri12y agoPosted Oct 1, 2014, 1:23 AM you are using inside Update panel please paste Design code ...
SKShradha Kale12y agoPosted Oct 1, 2014, 1:22 AMin above code even if the textbox are not null it shows null
Saineshwar Bageri12y agoPosted Oct 1, 2014, 1:15 AMtried this var StoreName= document.getElementById('<%=txt_Inv_StoreName.ClientID%>');
SKShradha Kale12y agoPosted Oct 1, 2014, 1:13 AMI even tried this but it dosen't solve my problem..I want to check whether the textbox is are empty or not.
Saineshwar Bageri12y agoPosted Oct 1, 2014, 1:09 AMSample checkThe error is here: var fdate = document.getElementById('txtFromDate'); var edate = document.getElementById('txtToDate');The problem is that txtFromDate and txtToDate are the server name of controls, not the client name (look the source of page from the browser).Try this: var fdate = document.getElementById('<%=txtFromDate.ClientID%>'); var edate = document.getElementById('<%=txtToDate.ClientID%>');
SKShradha Kale12y agoPosted Oct 1, 2014, 1:07 AMgetting error while calling function from ajax enabled content page.
Saineshwar BageriPosted Oct 1, 2014, 1:41 AM
Mark as Answer if i help you
Vithal WadjePosted Oct 13, 2014, 2:16 PM
arun prasathPosted Oct 6, 2014, 4:12 AM
Shradha KalePosted Oct 1, 2014, 7:51 AM
Shradha KalePosted Oct 1, 2014, 1:30 AM
Shradha KalePosted Oct 1, 2014, 1:28 AM
Saineshwar BageriPosted Oct 1, 2014, 1:23 AM
Shradha KalePosted Oct 1, 2014, 1:22 AM
Saineshwar BageriPosted Oct 1, 2014, 1:15 AM
var StoreName= document.getElementById('<%=txt_Inv_StoreName.ClientID%>');
Shradha KalePosted Oct 1, 2014, 1:13 AM
Saineshwar BageriPosted Oct 1, 2014, 1:09 AM
The error is here:
var fdate = document.getElementById('txtFromDate');
var edate = document.getElementById('txtToDate');
The problem is that txtFromDate and txtToDate are the server name of controls, not the client name (look the source of page from the browser).
Try this:
var fdate = document.getElementById('<%=txtFromDate.ClientID%>');
var edate = document.getElementById('<%=txtToDate.ClientID%>');
Shradha KalePosted Oct 1, 2014, 1:07 AM
Saineshwar BageriPosted Sep 30, 2014, 12:10 AM