Problem with javascript

Hi,
within the page, once I've clicked one button, I get this
https://dl.dropboxusercontent.com/u/40211031/tt172.png
 
and further have got this
https://dl.dropboxusercontent.com/u/40211031/tt173.png
 
If I press F12, nothing happens. How to further check the reason of it?
LVL 11
HuaMin ChenProblem resolverAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongCommented:
Check this out, make sure the webpage URL is valid...

"This webpage is not available"
https://support.google.com/chromebook/answer/1085581?hl=en
0
HuaMin ChenProblem resolverAuthor Commented:
Sorry, the page is now being run using IE 8. But the point is, there is no such problem, to run one other web page, using also IE 8. How to find out anything wrong to the current web-page?
0
Ryan ChongCommented:
try this and see if you can see any errors

>>To enable script debugging in Internet Explorer
On the Tools menu, click Internet Options.
In the Internet Options dialog box, click the Advanced tab.
In the Browsing category, clear the Disable script debugging check box.
Click OK.
Exit and restart Internet Explorer.

How to: Enable and Start Script Debugging from Internet Explorer
https://msdn.microsoft.com/en-us/library/z959x58c.aspx
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

HuaMin ChenProblem resolverAuthor Commented:
Sorry, what to further choose in the following?
22
0
Ryan ChongCommented:
Not too sure why you can't see the "Browsing" category from your IE option settings, it could be some configuration which make it disappeared from the list.

In your IE, goto menu Tools > Developer Tools (F12) and see if you can found some clues there?

Anyway, I believe you are using .NET for your programming? You can always put the breakpoints and using step for debugging

Start, Break, Step, Run through Code, and Stop Debugging in Visual Studio
https://msdn.microsoft.com/en-us/library/y740d9d3.aspx

Mastering Debugging in Visual Studio 2010 - A Beginner's Guide
http://www.codeproject.com/Articles/79508/Mastering-Debugging-in-Visual-Studio-A-Beginn
0
HuaMin ChenProblem resolverAuthor Commented:
Thanks a lot. I press F12 and do not see any error shown in there.

Here is the button,
                <asp:TemplateField ShowHeader="False">
                    <ItemTemplate>
                        <asp:LinkButton ID="lbEdit" runat="server" CausesValidation="False"
                            CommandName="RowEdit" Text="更改資料" CommandArgument='<%# Eval("Id") %>'></asp:LinkButton>
                            ...
 

Open in new window

on which the error happens.
0
Ryan ChongCommented:
Let me try get back to you later, apparently I can't access to the dropbox images you first uploaded.
0
HuaMin ChenProblem resolverAuthor Commented:
Here are the 2 screenshots.
22b22c
0
HuaMin ChenProblem resolverAuthor Commented:
They are the same ones.
0
Ryan ChongCommented:
what if you double clicked the errors? (double click the triangle alert icon) We need to know the exact errors returned.
0
HuaMin ChenProblem resolverAuthor Commented:
Thanks a lot.
Here are the details which I've got:

Message: Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.
Line: 938
Character: 13
Program code: 0
URI: http://10.2.1.26/conv_store_test/ScriptResource.axd?d=L5pykDqRS5jLLnKgsKzHcZEmi9b5HWRsKU96edCnLQrnJ3e0iGCYzagowXiH1HxGN_6Q1KjWQ726sPR_ovYcLg2&t=fffffffffb3279ba

Open in new window

0
Ryan ChongCommented:
>>Object reference not set to an instance of an object
You probably referring to an object that not yet defined

can you tell us what code is at line: 938 in your script and codes nearby of it?
0
HuaMin ChenProblem resolverAuthor Commented:
Many thanks Ryan. There is no line 938 within the current .aspx and .cs files.

The problem is regarding Edit button. How to ensure which are the codes being called, when I press such Edit button?
0
Ryan ChongCommented:
can you post a more complete error message relating to error above?

can you also post relevant codes here?
0
HuaMin ChenProblem resolverAuthor Commented:
I only get the message which is being shown in above.

Regarding such part
                <asp:TemplateField ShowHeader="False">
                    <ItemTemplate>
                        <asp:LinkButton ID="lbEdit" runat="server" CausesValidation="False"
                            CommandName="RowEdit" Text="更改資料" CommandArgument='<%# Eval("Id") %>'></asp:LinkButton>
                            ...

Open in new window

on the page, is it true that the click event would further call this event below?
 
    protected void gvResult_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string id = Convert.ToString(e.CommandArgument);
 
        MySqlConnection conn = DBUtil.GetConnectionMySql(ConvStoreUtil.DB_CONN);
        DataTable dt;
 
        string sql;
 
        switch (e.CommandName)
        {
            case "RowEdit":
                ...

Open in new window


If yes, what can be the reason of the problem?
0
Ryan ChongCommented:
Is this error only occurred after you click the button in your Gridview?

not much idea to debug without knowing further how you writing the scripts... anyway... can you post the whole scripts for your Gridview <asp:GridView ID="gvResult"....  as well as gvResult_RowCommand?
0
Tom BeckCommented:
There is no line 938 within the current .aspx and .cs files.
The web browser does not see and can not interpret the ASP controls and C# code in your aspx and cs files. Only the web server can run server side code. It sends the results in html and javascript to the browser. There's no reason to look in the asp or cs files for the source of the error. Line 938 refers to a line in the source code for the resulting html page.

javascript._doPostBack() is the standard javascript function asp.net uses for posting instructions back to the web server.

Type "asp.net __dopostback is not defined" into a Google search and you will get many suggestions for troubleshooting this problem.
0
HuaMin ChenProblem resolverAuthor Commented:
Many thanks all.
 
To this error
 
Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.
 

how to further trace the reason of the problem?
0
HuaMin ChenProblem resolverAuthor Commented:
Tom,
Can I know where you see this error happens?
 
asp.net __dopostback is not defined
0
Tom BeckCommented:
Of course you can step trough the javascript code line by line using the IE11 Developer Tools.

If you are getting this:

Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.

On a control in the html source code that calls this .

javascript._doPostBack()

The most likely cause is that a function by the name of _doPostBack does not exist on the page or in any javascript include file. This function is automatically included in the html source of any asp page that requires a post back. It would appear that for some reason, your asp.net setup is not including that function on the rendered page. Look at the view source of the rendered page to confirm that indeed a function with the name _doPostBack is not available to the page.
0
HuaMin ChenProblem resolverAuthor Commented:
Thanks a lot.
When viewing the source, I can see the codes having 'postback' like
               
 <table cellpadding="0" cellspacing="0" style="border-width:0;">
                        <tr>
                                <td class="menu1_TreeView1_2" onmouseover="TreeView_HoverNode(menu1_TreeView1_Data, this)" onmouseout="TreeView_UnhoverNode(this)" style="white-space:nowrap;"><a class="menu1_TreeView1_0 menu1_TreeView1_1" href="javascript:__doPostBack('menu1$TreeView1','ssystem')" onclick="TreeView_SelectNode(menu1_TreeView1_Data, this,'menu1_TreeView1n0');" id="menu1_TreeView1n0">系統</a></td>
                        </tr>
                        ...
                </div><table cellpadding="0" cellspacing="0" style="border-width:0;">
                        <tr>
                                <td class="menu1_TreeView1_2" onmouseover="TreeView_HoverNode(menu1_TreeView1_Data, this)" onmouseout="TreeView_UnhoverNode(this)" style="white-space:nowrap;"><a class="menu1_TreeView1_0 menu1_TreeView1_1" href="javascript:__doPostBack('menu1$TreeView1','srpt')" onclick="TreeView_SelectNode(menu1_TreeView1_Data, this,'menu1_TreeView1n15');" id="menu1_TreeView1n15">報表 (7-11)</a></td>
                                ...

Open in new window

how to identify the reason of the current problem?
0
Tom BeckCommented:
Yes, you can see where the function is being called in the html but can you find the function  _doPostBack() somewhere on the page? It would be in a <script> block  on the page or in a .js file included with the page.
0
HuaMin ChenProblem resolverAuthor Commented:
Can you please advise to the problem shown now?
23
0
Ryan ChongCommented:
is there rows available in dt? what is returned from dt.Rows.Count?
0
HuaMin ChenProblem resolverAuthor Commented:
do you mean there can be no records returned by DT? how to avoid the problem, if no records returned?
0
Ryan ChongCommented:
>>how to avoid the problem, if no records returned?

like?

if (dt.Rows.Count > 0) {
      ddlRemoteCharge2.Items.FindByValue(Convert.ToString(dt.Rows[0]["remote_charge2"])).Selected = true;
}
0
HuaMin ChenProblem resolverAuthor Commented:
I adjust the codes but I still get the same problem
23c
0
Ryan ChongCommented:
is dt.Rows[0]["remote_charge2"]) returned null value?

try:

if (dt.Rows[0]["remote_charge2"] != null) {
      ddlRemoteCharge2.Items.FindByValue(Convert.ToString(dt.Rows[0]["remote_charge2"])).Selected = true;
}
0
HuaMin ChenProblem resolverAuthor Commented:
Sorry, I still get the same problem
23g
0
HuaMin ChenProblem resolverAuthor Commented:
after having applied your advice
0
HuaMin ChenProblem resolverAuthor Commented:
Any other help?
0
Ryan ChongCommented:
sorry as currently I'm no longer doing C# programming, so I merely write the code without an environment which I can test my own scripts with...

but you may try this

if (dt.Rows[0]["remote_charge2"] != null) {
     if (ddlRemoteCharge2.Items.FindByValue(Convert.ToString(dt.Rows[0]["remote_charge2"])) != null) {
          ddlRemoteCharge2.Items.FindByValue(Convert.ToString(dt.Rows[0]["remote_charge2"])).Selected = true;
     }
}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tom BeckCommented:
Was that the solution?  Is the problem solved?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.