Click here to Skip to main content
15,886,724 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: gridview buttons and client side scripting Pin
Abhishek Sur4-Sep-09 9:48
professionalAbhishek Sur4-Sep-09 9:48 
GeneralRe: gridview buttons and client side scripting Pin
compninja254-Sep-09 9:50
compninja254-Sep-09 9:50 
GeneralRe: gridview buttons and client side scripting Pin
Abhishek Sur4-Sep-09 11:16
professionalAbhishek Sur4-Sep-09 11:16 
GeneralRe: gridview buttons and client side scripting Pin
compninja258-Sep-09 3:29
compninja258-Sep-09 3:29 
GeneralRe: gridview buttons and client side scripting Pin
Abhishek Sur8-Sep-09 10:59
professionalAbhishek Sur8-Sep-09 10:59 
GeneralRe: gridview buttons and client side scripting Pin
compninja259-Sep-09 10:19
compninja259-Sep-09 10:19 
GeneralRe: gridview buttons and client side scripting Pin
Abhishek Sur10-Sep-09 0:39
professionalAbhishek Sur10-Sep-09 0:39 
GeneralRe: gridview buttons and client side scripting Pin
compninja2510-Sep-09 2:51
compninja2510-Sep-09 2: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 8:04
Lonnie Raffray4-Sep-09 8:04 
AnswerRe: Document elements have no IDs Pin
Abhishek Sur4-Sep-09 9:35
professionalAbhishek Sur4-Sep-09 9:35 
GeneralRe: Document elements have no IDs Pin
Lonnie Raffray4-Sep-09 9:37
Lonnie Raffray4-Sep-09 9:37 
GeneralRe: Document elements have no IDs Pin
Abhishek Sur4-Sep-09 9:39
professionalAbhishek Sur4-Sep-09 9:39 
QuestionLink button inside the Gridview Pin
Vimalsoft(Pty) Ltd4-Sep-09 4:13
professionalVimalsoft(Pty) Ltd4-Sep-09 4:13 
AnswerRe: Link button inside the Gridview Pin
Blue_Boy4-Sep-09 5:45
Blue_Boy4-Sep-09 5:45 
GeneralRe: Link button inside the Gridview Pin
Vimalsoft(Pty) Ltd6-Sep-09 20:12
professionalVimalsoft(Pty) Ltd6-Sep-09 20:12 
AnswerRe: Link button inside the Gridview Pin
Abhijit Jana4-Sep-09 6:59
professionalAbhijit Jana4-Sep-09 6:59 
GeneralRe: Link button inside the Gridview Pin
Vimalsoft(Pty) Ltd6-Sep-09 20:13
professionalVimalsoft(Pty) Ltd6-Sep-09 20:13 
AnswerRe: Link button inside the Gridview Pin
Abhishek Sur4-Sep-09 8:02
professionalAbhishek Sur4-Sep-09 8:02 
GeneralRe: Link button inside the Gridview Pin
Vimalsoft(Pty) Ltd6-Sep-09 20:13
professionalVimalsoft(Pty) Ltd6-Sep-09 20:13 
AnswerRe: Link button inside the Gridview Pin
CrazyCoder265-Sep-09 0:31
CrazyCoder265-Sep-09 0:31 
GeneralRe: Link button inside the Gridview Pin
Vimalsoft(Pty) Ltd6-Sep-09 20:14
professionalVimalsoft(Pty) Ltd6-Sep-09 20:14 
QuestionUser visit stats... Pin
Abbas_here4-Sep-09 3:20
Abbas_here4-Sep-09 3:20 
AnswerRe: User visit stats... Pin
Blue_Boy4-Sep-09 5:55
Blue_Boy4-Sep-09 5:55 
AnswerRe: User visit stats... Pin
Jay Royall4-Sep-09 6:26
Jay Royall4-Sep-09 6:26 
AnswerRe: User visit stats... Pin
Abhijit Jana4-Sep-09 7:01
professionalAbhijit Jana4-Sep-09 7: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.