Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Post info back to custom form

Author  Topic 

besadmin
Posting Yak Master

116 Posts

Posted - 2008-11-18 : 15:40:23
Hello;
this is a complex question, i will explain as best as i can.
i have a custom form: name, purchase date, ram, etc.. for PC's and stuff. you fill it out and submit and info is stored in SQL database. then you can view all info in the database on another page in a gridview (asp.net)
i have 'Edit' enabled on the gridview, but that lets you edit inline in the gridview.
My question is can i make it so when you click 'Edit' the info from that row in the gridview posts back into the original custom form for editing.

Thanks for any help and replys!

Later,

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2008-11-18 : 16:11:58
quote:
Originally posted by besadmin


My question is can i make it so when you click 'Edit' the info from that row in the gridview posts back into the original custom form for editing.

Thanks for any help and replys!

Later,




You dont have to do that, you can use AJAX. Which makes life a lot easier for you, and allows you to edit it without the page being posted back.

You can also use the objectdatasource to add custom classes which will call your SP to edit, update or delete fields.

Go to Top of Page

cvraghu
Posting Yak Master

187 Posts

Posted - 2008-11-19 : 03:24:57
If you still want to take the user to edit form, there are couple of options -

1. Make one of the column (ex name) as hyper link and take the user to edit form.

2. Create one more column with buttons clciking on which will take you to the edit form.
Go to Top of Page

besadmin
Posting Yak Master

116 Posts

Posted - 2008-11-19 : 16:29:13
hey, thanks for the replys.
here is a little more clarification on what i need though.
there is a from that i made with textboxes etc...you fill in data, submit and it gets inserted to sql database.
then a different page you can view that data in a gridview, with editing capabilities.
however, my boss would like it that when you click edit on a row in the gridview, instead of editing it there in the gridview since there are a lot of columns, it would be better if you click edit and that data then repopulates in the original form i created for entering the data.
so, i dont know if i can do that with ajax afrika?
thanks for the replys though! much appreciated, as will any more help be!
thanks again!
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2008-11-19 : 17:07:47
I dont understand what you mean populate the form, I thought the form and gridview are on seperate pages.

About ajax, it would amaze you the amount of things you can achieve with it, and even more amazing is how simple to use ajax is, once you have a grasps of .net code behind. I dont have a page developed today, that hasnt some ajax capability. Its amazing,powerful and very simple to implement.
Go to Top of Page

cvraghu
Posting Yak Master

187 Posts

Posted - 2008-11-20 : 00:02:56
Yes you can fill the form with values. You've to pass the id of the edited row to the next page and fetch the data for the id by whatever way you decide.
Go to Top of Page

besadmin
Posting Yak Master

116 Posts

Posted - 2008-11-20 : 12:43:59
afrika, i will try and explain again, thanks for replying. also, i have used a little ajax before, it is definatley nice! - Anyway yes they are on 2 separate pages. we will use a computer as an example. you want to add to database so you go to just a FORM page i built and enter in all the fields, submit, then finsihed. Then you can go to another page to view all of the items in the gridview with update and delete enabled. however, instead of updating in the gridview i want it to be so you click edit it takes you back to the original form that i created for first entering data, all the fields are repopulated with the data from the row you click edit on, then you can do all of your editing in that form. hope that helps.

cvraghu i think you are on the right track of what i am trying to accomplish. thanks a lot for the reply! do you know of any sample code or anything i could use? or what technique would i use to take the values from each column of a row in the gridview and get them to insert into to corresponding fields of the form?

Thanks again for you help!!

-S
Go to Top of Page

cvraghu
Posting Yak Master

187 Posts

Posted - 2008-11-21 : 00:11:07
You can google or search any asp.net forums for similar stuffs. Here are some tips -

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.datakeys.aspx

http://www.dotnetfunda.com/articles/article153.aspx

Go to Top of Page
   

- Advertisement -