Click here to Skip to main content
15,503,579 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: gridview buttons and client side scripting Pin
Abhishek Sur4-Sep-09 10:48
professionalAbhishek Sur4-Sep-09 10:48 
GeneralRe: gridview buttons and client side scripting Pin
compninja254-Sep-09 10:50
compninja254-Sep-09 10:50 
GeneralRe: gridview buttons and client side scripting Pin
Abhishek Sur4-Sep-09 12:16
professionalAbhishek Sur4-Sep-09 12:16 
GeneralRe: gridview buttons and client side scripting Pin
compninja258-Sep-09 4:29
compninja258-Sep-09 4:29 
GeneralRe: gridview buttons and client side scripting Pin
Abhishek Sur8-Sep-09 11:59
professionalAbhishek Sur8-Sep-09 11:59 
GeneralRe: gridview buttons and client side scripting Pin
compninja259-Sep-09 11:19
compninja259-Sep-09 11:19 
GeneralRe: gridview buttons and client side scripting Pin
Abhishek Sur10-Sep-09 1:39
professionalAbhishek Sur10-Sep-09 1:39 
GeneralRe: gridview buttons and client side scripting Pin
compninja2510-Sep-09 3:51
compninja2510-Sep-09 3:51 
dang..it is calling the javascript but still issuing the post back to the server and throwing a validation error. I did view the source and I believe the problem lies in the fact that all of the buttons are of type "submit". Is there a way I can programatically change them to type="button" instead? I tried button.Attributes.Add("type", "button") but they are still ending up in the browser as type="submit". Doesn't make any sense. I've seen a ton of forums and articles now indicating that what you've suggested should just work.
[UPDATE] It dawned on me that it was probably because I never changed the UseSubmitBehavior parameter on the button. If I change this to false, then the javascript fires without trying to submit, however it is still posting back and refreshing the page, causing my javascript changes to dissapear during the server's page load. The only way I've found so far to keep the page from refreshing is adding the PostBackURL parameter, but if I do that then all of my buttons on the page seem to "inherit" this and then they won't work. grr!

if (e.Row.RowType == DataControlRowType.DataRow)
           {
               Label lb1 = (Label)e.Row.FindControl("label1");
               Button btminus = (Button)e.Row.FindControl("minus_qty");
               btminus.UseSubmitBehavior = false;
               btminus.Attributes.Add("onclick", "javascript:decreaseQuantity('" + lb1.ClientID + "');");
               Button btplus = (Button)e.Row.FindControl("plus_qty");
               btplus.UseSubmitBehavior = false;
               btplus.Attributes.Add("onclick", "javascript:increaseQuantity('" + lb1.ClientID + "');");
           }


Knowledge is not power, however, the acquisition and appropriate application of knowledge can make you a very powerful individual.

QuestionDocument elements have no IDs Pin
Lonnie Raffray4-Sep-09 9:04
Lonnie Raffray4-Sep-09 9:04 
AnswerRe: Document elements have no IDs Pin
Abhishek Sur4-Sep-09 10:35
professionalAbhishek Sur4-Sep-09 10:35 
GeneralRe: Document elements have no IDs Pin
Lonnie Raffray4-Sep-09 10:37
Lonnie Raffray4-Sep-09 10:37 
GeneralRe: Document elements have no IDs Pin
Abhishek Sur4-Sep-09 10:39
professionalAbhishek Sur4-Sep-09 10:39 
QuestionLink button inside the Gridview Pin
Vimalsoft(Pty) Ltd4-Sep-09 5:13
professionalVimalsoft(Pty) Ltd4-Sep-09 5:13 
AnswerRe: Link button inside the Gridview Pin
Blue_Boy4-Sep-09 6:45
Blue_Boy4-Sep-09 6:45 
GeneralRe: Link button inside the Gridview Pin
Vimalsoft(Pty) Ltd6-Sep-09 21:12
professionalVimalsoft(Pty) Ltd6-Sep-09 21:12 
AnswerRe: Link button inside the Gridview Pin
Abhijit Jana4-Sep-09 7:59
professionalAbhijit Jana4-Sep-09 7:59 
GeneralRe: Link button inside the Gridview Pin
Vimalsoft(Pty) Ltd6-Sep-09 21:13
professionalVimalsoft(Pty) Ltd6-Sep-09 21:13 
AnswerRe: Link button inside the Gridview Pin
Abhishek Sur4-Sep-09 9:02
professionalAbhishek Sur4-Sep-09 9:02 
GeneralRe: Link button inside the Gridview Pin
Vimalsoft(Pty) Ltd6-Sep-09 21:13
professionalVimalsoft(Pty) Ltd6-Sep-09 21:13 
AnswerRe: Link button inside the Gridview Pin
CrazyCoder265-Sep-09 1:31
CrazyCoder265-Sep-09 1:31 
GeneralRe: Link button inside the Gridview Pin
Vimalsoft(Pty) Ltd6-Sep-09 21:14
professionalVimalsoft(Pty) Ltd6-Sep-09 21:14 
QuestionUser visit stats... Pin
Abbas_here4-Sep-09 4:20
Abbas_here4-Sep-09 4:20 
AnswerRe: User visit stats... Pin
Blue_Boy4-Sep-09 6:55
Blue_Boy4-Sep-09 6:55 
AnswerRe: User visit stats... Pin
Jay Royall4-Sep-09 7:26
Jay Royall4-Sep-09 7:26 
AnswerRe: User visit stats... Pin
Abhijit Jana4-Sep-09 8:01
professionalAbhijit Jana4-Sep-09 8:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.