c# - A few questions regarding web based c#programming with visual studio 2010 and mysql -


i'm making web based inventory database connected mysql, , have purchase order(po) page incoming stocks, delivery receipt(dr) page outgoing stocks , stock list page.

in po page grid view of po table connected mysql edit , delete enabled , edit linked separate page. same goes dr page. stock page has grid view of stock table connected mysql edit enabled.

i have separate add new page , edit page po , dr. both add , edit pages have details view in them. here questions.

1. how automatically insert records inserted in add page using details view both po , dr stock table. stock table looks this:

stock_id | date | po_id | dr_id | product_id | stock_in | stock_out | stock_balance |

what want happen when enter either new dr or po, it'll go stock table automatically respective tables , stock balance adjust automatically.

2. in details view of add new po, edited details view when choose supplier , product choose drop down list connected respective table, how limit product user can choose in regards supplier /she chooses. let's choose supplier 1 , products supplies products 1 , 2. want happen when choose supplier 1 products can choose limited products 1 , 2.

this link addpo source code

http://pastebin.com/download.php?i=5aaqhsc4

this link addpo.cs source code

http://pastebin.com/download.php?i=mz8gdlfx

edit

  1. the insertcommand should fired when linkbutton commandname="insert" clicked, have @ bottom of form. can try querying error messages during iteminserted event using detailsviewinsertedeventargs.exceptionhandled check if there unhandled exception, , detailsviewinsertedeventargs .exception details of exception. work if remove of logic have placed in iteminserting event?

  2. your sqldatasource products dropdown should have parameter of supplierid, , selectcommand should filter based on parameter.

example code sqldatasource:

<asp:sqldatasource id="sqldatasource1"         selectcommand="select * products supplierid=@supplierid">     <selectparameters>         <asp:parameter name="supplierid" />     </selectparameters> </asp:sqldatasource> 

example binding code (replace correct control id's):

protected void sqldatasource1_selecting(        object sender, sqldatasourceselectingeventargs e) {     dropdown supplierdropdown =          mydetailsview.findcontrol("supplierdropdown") dropdown;     e.arguments["supplierid"] = supplierdropdown.selectedvalue; } 

old

  1. if data connected datasource control, set insertstatement or oninsert event appropriate code handle inserting according spec. if you're binding detailsview programmatically, need handle iteminserting event of detailsview, or use custom logic in submit button. see http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.detailsview.iteminserting.aspx more information.

  2. use controlparameter on data source of products dropdown, tied selected value of supplier dropdown. set autopostback=true on suppliers dropdown, time selection made, products list updated accordingly.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -