Weird LinkButton!

S

Shivakumar

Hi all,
Recently i have updated my vs.net 2003 project to vs.net 2005 and i
have successfully converted my code and found no problem with all my
controls except the one which is the linkbutton.

I have added the linkbutton control in my datagrid and it rendered perfectly
but whenever i clicked the linkbutton am getting this error

'event' is null or not an object.

I have checked with all the possibilities like using aspnet_regiis -i and
aspnet_regiis -c etc., and all my other controls like button, hyperlink and
all my javascripts work fine.

I have used Scott Mitchell's skmlinkbutton, so i thought that would be
having some problem, so i removed that control and put microsoft's built in
linkbutton control and for my surprise am getting the same error. i checked
with the rendered javascript function which is in the following format.


javascript:WebForm_DoPostBackWithOptions(new
WebForm_PostBackOptions("dgScreenDetails:_ctl6:nlnDelete", "", true, "", "",
false, true))

i didnt understand what this script says(i mean parameters) and i compared
with some other script and found the target page is not rendered. but still
i couldnt able to find out the exact reason for this error. can anyone
please do help to solve this issue coz my whole project got stuck because of
this simple javascript error.

Microsoft guys please do help me!.

Thanks in advance,
Shiva.
 
J

Jay Douglas

Are you running the Item event of the datagrid using a CommandName or the
click event on the link button?

One trouble shooting step could be re-adding the link button.
 
S

Shivakumar

jay,
Am using the command name of the datagrid.
<asp:LinkButton runat="server" ForeColor="#FF6633" Text='Publish'
ID="Linkbutton1" NAME="Label1" CommandName="Edit" CommandArgument='<%#
GetURL(Container,"Publish") %>'></asp:LinkButton>

GetURL has the following
--------------------------
case "Publish":

if( (DataBinder.Eval(Container, "DataItem.StatusCode")).ToString()=="100")

URL="Publish"+"|"+DataBinder.Eval(Container, "DataItem.ModuleID");

break;


and the edit command has the following code.
------------------------------------------------
protected void dgScreenDetails_EditCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)

{

string splitString = e.CommandArgument.ToString();

string[] arrCommandArgument = splitString.Split('|');

if (arrCommandArgument[0].ToString() == "Publish")

{

ModuleListingGeneralFunctions.PublishModule(arrCommandArgument[1].ToString());

BindDataToGrid();

}

}

NB: this code works fine when run in the local machine but throws javascript
error only when accessed from some other machine

Regards,

Shiva.
 
J

Jay Douglas

Does the /wwwroot folder have the 2.0 aspnet_client javascript?

--
Jay Douglas
http://www.jaydouglas.com


Shivakumar said:
jay,
Am using the command name of the datagrid.
<asp:LinkButton runat="server" ForeColor="#FF6633" Text='Publish'
ID="Linkbutton1" NAME="Label1" CommandName="Edit" CommandArgument='<%#
GetURL(Container,"Publish") %>'></asp:LinkButton>

GetURL has the following
--------------------------
case "Publish":

if( (DataBinder.Eval(Container, "DataItem.StatusCode")).ToString()=="100")

URL="Publish"+"|"+DataBinder.Eval(Container, "DataItem.ModuleID");

break;


and the edit command has the following code.
------------------------------------------------
protected void dgScreenDetails_EditCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)

{

string splitString = e.CommandArgument.ToString();

string[] arrCommandArgument = splitString.Split('|');

if (arrCommandArgument[0].ToString() == "Publish")

{

ModuleListingGeneralFunctions.PublishModule(arrCommandArgument[1].ToString());

BindDataToGrid();

}

}

NB: this code works fine when run in the local machine but throws
javascript error only when accessed from some other machine

Regards,

Shiva.
 
B

Bruce Barker

you should enable script debugging (advanced options in ie), and track down
the actual script error. unfortunately vs2005 generates its javascript on
the fly rather then using script files, so if its a coding error you will
need a hotfix.

-- bruce (sqlwork.com)
 
C

comzy

I did bruce and its telling the following line got error ( 'event' is
null or not an object)

<a id="dgScreenDetails__ctl5_Linkbutton1" NAME="Label1"
href="javascript:WebForm_DoPostBackWithOptions(new
WebForm_PostBackOptions("dgScreenDetails:_ctl5:Linkbutton1", "", true,
"", "", false, true))"

i couldnt parse this function, can u explain me if you know?

Regards,
Shiva
 
C

comzy

Hi all,
I myself found the error at last and fixed! it was problem
with WebUIValidation .js file. Thank you guys for trying to help me
out.

Regards,
Shiva
 
Joined
Mar 28, 2008
Messages
2
Reaction score
0
same problem in linkbutton

Hi
Can u tell me how u solved this problem of linkbutton. What did u do in WebUIValidation.js file. As i m also facing same problem.
 
Joined
Jun 4, 2008
Messages
2
Reaction score
0
Hi,

Has any of you been able to figure out and solve this problem with the WebUIValidation.js error. I'm experiencing the same problem right now. Basically, my LinkButton is giving me a 'Event' is null or not an object" Javascript error message, and I don't know how to fix it.

If so, can you share with me how you fixed it. Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top