Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 24, 2013 12:52 AM by Decker Dong - MSFT
Member
37 Points
370 Posts
Jan 22, 2013 04:42 AM|LINK
Hi all,
Hope doing well,
sir i am using one gridview in that i used linkbutton in item template so that in some cases i am making link button enable false.
so when i am checking in browser it's color is changing from blue to black but when i click on that it's getting fired.
how to make it enable false properly.
shocking man it's working fine in ie 8 but not working properly in firefox.
how to make it work in firefox?
thanks
Participant
1836 Points
583 Posts
Jan 22, 2013 05:00 AM|LINK
can you please post your code...u using
Jan 22, 2013 05:39 AM|LINK
Hi rima,
thanks for ur response.
here is my code below:
if (Convert.ToInt32(dRowView[10]) == 4) { LinkButton hypEdit = (LinkButton)e.Row.FindControl("btnEdit"); LinkButton hypdel = (LinkButton)e.Row.FindControl("btnDelete"); hypEdit.Enabled = false; hypdel.Enabled = false; }
Jan 22, 2013 05:44 AM|LINK
Is this code written on Rowdatabound event of Gridview?
Jan 22, 2013 05:45 AM|LINK
yes madam
in that only.
All-Star
36196 Points
7372 Posts
Jan 22, 2013 05:58 AM|LINK
Try using disabled attribute
disabled="disabled"
Contributor
3016 Points
576 Posts
Jan 22, 2013 05:59 AM|LINK
It may possible that some other event binding it again and thats why it is working fine.
Try by using your same code after binging datasource to gridview. Means try your code in seperate for loop which will check for each row of gridview.
I know it will not look good solution to try, but lets give it try and let us know...
Or else post your complete markup and code behind for better solution.
Also debug and check code whether it is throwing any exception, i think so bcoz of drow[10] is not used as drow[10].Text.ToString()
Jan 22, 2013 06:00 AM|LINK
if (e.Row.RowType == DataControlRowType.DataRow) { LinkButton hypEdit= (LinkButton)e.Row.FindControl("hypEdit"); if (Your if condtion) { hypEdit.Enabled = true; } else { hypEdit.Enabled = false; } }
Jan 22, 2013 06:51 AM|LINK
hi,
same code is there in my application but not working only for firefox.
working for ie 8 only.
Jan 22, 2013 07:09 AM|LINK
Thats wierd..check the error console...if you get any error out there..
Also are you using master page and toolkitcriptmanager...in that case...soetimes..linkbutton doesnt works.. Check out once again
vicky1
Member
37 Points
370 Posts
How to make linkbutton enable false in item template in gridview?
Jan 22, 2013 04:42 AM|LINK
Hi all,
Hope doing well,
sir i am using one gridview in that i used linkbutton in item template so that in some cases i am making link button enable false.
so when i am checking in browser it's color is changing from blue to black but when i click on that it's getting fired.
how to make it enable false properly.
shocking man it's working fine in ie 8 but not working properly in firefox.
how to make it work in firefox?
thanks
rimagandhi
Participant
1836 Points
583 Posts
Re: How to make linkbutton enable false in item template in gridview?
Jan 22, 2013 05:00 AM|LINK
can you please post your code...u using
Regards
Rima Gandhi.
Software Developer.
vicky1
Member
37 Points
370 Posts
Re: How to make linkbutton enable false in item template in gridview?
Jan 22, 2013 05:39 AM|LINK
Hi rima,
thanks for ur response.
here is my code below:
if (Convert.ToInt32(dRowView[10]) == 4)
{
LinkButton hypEdit = (LinkButton)e.Row.FindControl("btnEdit");
LinkButton hypdel = (LinkButton)e.Row.FindControl("btnDelete");
hypEdit.Enabled = false;
hypdel.Enabled = false;
}
rimagandhi
Participant
1836 Points
583 Posts
Re: How to make linkbutton enable false in item template in gridview?
Jan 22, 2013 05:44 AM|LINK
Is this code written on Rowdatabound event of Gridview?
Regards
Rima Gandhi.
Software Developer.
vicky1
Member
37 Points
370 Posts
Re: How to make linkbutton enable false in item template in gridview?
Jan 22, 2013 05:45 AM|LINK
yes madam
in that only.
oned_gk
All-Star
36196 Points
7372 Posts
Re: How to make linkbutton enable false in item template in gridview?
Jan 22, 2013 05:58 AM|LINK
Try using disabled attribute
disabled="disabled"
Suwandi - Non Graduate Programmer
Sujeet Saste
Contributor
3016 Points
576 Posts
Re: How to make linkbutton enable false in item template in gridview?
Jan 22, 2013 05:59 AM|LINK
It may possible that some other event binding it again and thats why it is working fine.
Try by using your same code after binging datasource to gridview. Means try your code in seperate for loop which will check for each row of gridview.
I know it will not look good solution to try, but lets give it try and let us know...
Or else post your complete markup and code behind for better solution.
Also debug and check code whether it is throwing any exception, i think so bcoz of drow[10] is not used as drow[10].Text.ToString()
Do FEAR (Face Everything And Rise)
Please mark as Answer if my post helps you..!
My Blog
rimagandhi
Participant
1836 Points
583 Posts
Re: How to make linkbutton enable false in item template in gridview?
Jan 22, 2013 06:00 AM|LINK
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton hypEdit= (LinkButton)e.Row.FindControl("hypEdit");
if (Your if condtion)
{
hypEdit.Enabled = true;
}
else
{
hypEdit.Enabled = false;
}
}
Regards
Rima Gandhi.
Software Developer.
vicky1
Member
37 Points
370 Posts
Re: How to make linkbutton enable false in item template in gridview?
Jan 22, 2013 06:51 AM|LINK
hi,
same code is there in my application but not working only for firefox.
working for ie 8 only.
thanks
rimagandhi
Participant
1836 Points
583 Posts
Re: How to make linkbutton enable false in item template in gridview?
Jan 22, 2013 07:09 AM|LINK
Thats wierd..check the error console...if you get any error out there..
Also are you using master page and toolkitcriptmanager...in that case...soetimes..linkbutton doesnt works.. Check out once again
Regards
Rima Gandhi.
Software Developer.