Add new row to grid via LinkButton

5 replies. Last post: February 22, 2011 11:01 PM by Handy Surya
Tags :
  • (None)
Zak CounidesMember
We are starting to use WebGrids to a high degree within our application, but one of the problems that the developers, users, testers, support, and training staff keep running into is that we currently have to tab through the row to add a new line item to a grid. I was looking at the grid and noticed a small box above the scrollbar, and after the last column. (See image below.) Is there any built in switch, javascript, or code that can be used to make like a 16x16 (or whatever size is needed) image/hyperlink/button/linkbutton/etc.. appear in this area so that the users are able to click it to add a new row to the grid? And if not is there a chance that this usability enhancement might make it into a future release?

Thanks,
Zak

All Replies

Hello,

So, you mean that you want to add a link/hyperlink button in there to accept the new row?
Normally, you can do it with using shift + enter. But, if you want to add a link/hyperlink button, you need to get the element of the object and insert link/hyperlink button in there.
However, wouldn't link/hyperlink button cause FullPostback to the page? If it does fullpostback, then I think would not be possible to use.

Regards,
Handy 

Well, that is why I was thinking that there might be something that I could call in javascript from like a button onclick to fire the event to add a new row to the grid. (Dont know what it is called offhand...) 

Hello,

Please open our WebGridSample>>DetailView.aspx. Does it suitable with your current scenario?

Regards,
Handy

I will take it to the clients and see how they feel about that solution, but I dont think that it will be adequete for the purpose of the page. I am considering disabling the add bar, and replacing it with the necessary controls in a table, with a link button that will add a new row to the grid with the selected items. WIll allow me to validate the data easier to prevent duplicates any way. Thanks.

Hello Zak,

You can hide the add new row but I am not sure if you can use link button since it would cause a fullpostback. At least, you know how to add the new row programmatically.
The rest is up to you which approach that you would like.

Regards,
Handy

All times are GMT -5. The time now is 1:10 PM.
Previous Next