Error in javascript functionSKShradha Kale12yAsked Sep 29, 2014, 7:42 PM EDTSolvedShareLinkedInXCopy linkSave0x800a138f - JavaScript runtime error: Unable to get property 'value' of undefined or null reference in asp.net web application application
Error in javascript functionSKShradha Kale12yAsked Sep 29, 2014, 7:42 PM EDTSolvedShareLinkedInXCopy linkSave0x800a138f - JavaScript runtime error: Unable to get property 'value' of undefined or null reference in asp.net web application application
Saineshwar BageriRank #115 · 19.6K reputation12y agoPosted Sep 30, 2014, 9:41 PM EDT✓ Accepted answer+1this works Mark as Answer if i help you+1
AParun prasath94 reputation12y agoPosted Oct 6, 2014, 12:12 AM EDT+1Instead 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.+1
Saineshwar BageriRank #115 · 19.6K reputation12y agoPosted Sep 29, 2014, 8:10 PM EDT0 Post your Javascript function please0
SKShradha Kale46 reputation12y agoPosted Sep 30, 2014, 9:07 PM EDT0getting error while calling function from ajax enabled content page.0
Saineshwar BageriRank #115 · 19.6K reputation12y agoPosted Sep 30, 2014, 9:09 PM EDT0Sample 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%>');0
SKShradha Kale46 reputation12y agoPosted Sep 30, 2014, 9:13 PM EDT0I even tried this but it dosen't solve my problem..I want to check whether the textbox is are empty or not.0
Saineshwar BageriRank #115 · 19.6K reputation12y agoPosted Sep 30, 2014, 9:15 PM EDT0tried this var StoreName= document.getElementById('<%=txt_Inv_StoreName.ClientID%>');0
SKShradha Kale46 reputation12y agoPosted Sep 30, 2014, 9:22 PM EDT0in above code even if the textbox are not null it shows null0
Saineshwar BageriRank #115 · 19.6K reputation12y agoPosted Sep 30, 2014, 9:23 PM EDT0 you are using inside Update panel please paste Design code ...0
SKShradha Kale46 reputation12y agoPosted Sep 30, 2014, 9:28 PM EDT0<%@ 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"> 0SKShradha Kale46 reputation12y agoPosted Sep 30, 2014, 9:30 PM EDT00SKShradha Kale46 reputation12y agoPosted Oct 1, 2014, 3:51 AM EDT0It works..Thanks a lot...0Vithal WadjeRank #19 · 47.2K reputation12y agoPosted Oct 13, 2014, 10:16 AM EDT0yes Arun,Thats also solution0Join to answer this questionEvery answer you publish earns 20 SHARP.Create free accountSign inKnow the answer?Answer a question in the forums and earn +20 SHARP for every answer.See unanswered questionsForumsTop experts01Arun PottiAnswers in the forums20answers02Tahir AnsariAnswers in the forums5answers03Kamlesh KumarAnswers in the forums5answers04Sam HobbsAnswers in the forums4answers05Željko PerićAnswers in the forums3answers?YouYour name goes here.Every answer: 20 SHARP.JoinFull leaderboard →2026DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Vithal WadjeRank #19 · 47.2K reputation12y agoPosted Oct 13, 2014, 10:16 AM EDT0yes Arun,Thats also solution0
Saineshwar BageriRank #115 · 19.6K reputationPosted Sep 30, 2014, 9:41 PM EDT
Mark as Answer if i help you
arun prasath94 reputationPosted Oct 6, 2014, 12:12 AM EDT
Saineshwar BageriRank #115 · 19.6K reputationPosted Sep 29, 2014, 8:10 PM EDT
Shradha Kale46 reputationPosted Sep 30, 2014, 9:07 PM EDT
Saineshwar BageriRank #115 · 19.6K reputationPosted Sep 30, 2014, 9:09 PM EDT
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 Kale46 reputationPosted Sep 30, 2014, 9:13 PM EDT
Saineshwar BageriRank #115 · 19.6K reputationPosted Sep 30, 2014, 9:15 PM EDT
var StoreName= document.getElementById('<%=txt_Inv_StoreName.ClientID%>');
Shradha Kale46 reputationPosted Sep 30, 2014, 9:22 PM EDT
Saineshwar BageriRank #115 · 19.6K reputationPosted Sep 30, 2014, 9:23 PM EDT
Shradha Kale46 reputationPosted Sep 30, 2014, 9:28 PM EDT
Shradha Kale46 reputationPosted Sep 30, 2014, 9:30 PM EDT
Shradha Kale46 reputationPosted Oct 1, 2014, 3:51 AM EDT
Vithal WadjeRank #19 · 47.2K reputationPosted Oct 13, 2014, 10:16 AM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts