Click here to Skip to main content
15,889,909 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I want to create functionality in gridview like...

I have 3 textbox inside my grid

1.ProductID.
2.ProductName.
3.ProductSize.

I used JQuery to enter ProductName by giving Suggestions to the user.Its works fine and display Perfectly. But now i want to use that ProductName and search the DB and fill the ProductID and ProductSize

I used onBlur event using AJAX Querystring, by passing my ProductName and getting the ProductID and ProductSize. Till that works fine for me. But while Place it into the Respective row its not works for me. Even i used StyleSheet Class to assign the respective values to the text box, its assign those values to entire grid not that particular row.


Please help me out...


Thanks in Advance.
Posted
Updated 4-Jul-11 1:21am
v3

Try the following link.
http://forums.asp.net/t/1278872.aspx[^]
 
Share this answer
 
Comments
J.Karthick 4-Jul-11 5:15am    
Thanks...i got a brief explanation
Tech Code Freak 5-Jul-11 5:58am    
My 5!
Monjurul Habib 5-Jul-11 6:58am    
thank you
Rubaba 6-Jul-11 0:59am    
good answer.+5
Monjurul Habib 6-Jul-11 13:15pm    
thank you
Please don't ask the same questions over and over. You should edit your original question, if you need to provide more detail to get a better answer. The answer remains, you need to make an AJAX call to do that. The ASP.NET AJAX library is your best shot at doing this, esp given the level of confusion revealed the first time you asked this.
 
Share this answer
 
Comments
J.Karthick 4-Jul-11 5:18am    
But Christian again and again i'm asking, how to do that?
From the beginning, you are saying "USE AJAX", "USE AJAX"... but you didnt tell how to use it..But now i got a solution from this post only...
Christian Graus 4-Jul-11 6:05am    
Well, first of all, if you were a programmer at all, you'd be capable of typing 'ASP.NET AJAX' in to google to read up on it. Secondly, it does not change that you can edit your post, and not leave orphan posts through the site because you kept asking the same question over and over until someone gave you code to copy and paste because you're too lazy to do basic research.
From the onblur event handler you can call your page methods. Try this link.

Hope this helps!
 
Share this answer
 
Comments
J.Karthick 4-Jul-11 5:20am    
Excellent brief...Thanks for sharing...
While you are registering the OnBlur event, you can provide the ClientId of your other two textboxes to the function through the server side on row databound event of your gridview.
This way your client side function for OnBLur event will have ClientId of textbox and then you set values in those textboxes.
 
Share this answer
 
Comments
J.Karthick 4-Jul-11 9:52am    
While i mention ClientID of Gridtextbox inside my Script it shows error like "unknown text field" . How can do it?
Something like this:

protected void gridview_RowDataBound(object sender, GridViewRowEventArgs e)
{
   if (e.Row.RowType == DataControlRowType.DataRow)
   {
      //Get your textbox
      Textbox tb = e.Row.FindControl("tbAddUp");
      Textbox tbNum1 = e.Row.FindControl("tbnum1");
      Textbox tbNum2 = e.Row.FindControl("tbNum2");
      //Add the event that you're going to call to this textbox's attributes
      tb.Attributes.Add("onBlur", "MyAddClientSideMethod('" +  tbNum1.ClientID + "','"+tbNum2.ClientID+"');");

   }
}


In this way all three textboxes belonging to specific row of gridview will be registered with your client side function. So now you already have ClientIds with you in your client side function. This way it will solve your issue.
Hope this helps !!!
 
Share this answer
 
you just have to place the event in the textbox

onblur="alert('este es el javascript')"

the control when not finding anything from the server side, it just passes it to the client side.

At the end you would have something like:

<asp:Textbox Id="miControl" ... onblur="alert('este es el js')" ... >

Cheers
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900