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
edit
the
insertcommand
should fired whenlinkbutton
commandname="insert"
clicked, have @ bottom of form. can try querying error messages duringiteminserted
event usingdetailsviewinsertedeventargs.exceptionhandled
check if there unhandled exception, ,detailsviewinsertedeventargs .exception
details of exception. work if remove of logic have placed initeminserting
event?your
sqldatasource
productsdropdown
should have parameter ofsupplierid
, ,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
if data connected
datasource
control, setinsertstatement
oroninsert
event appropriate code handle inserting according spec. if you're bindingdetailsview
programmatically, need handleiteminserting
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.use
controlparameter
on data source of productsdropdown
, tied selected value of supplierdropdown
. setautopostback=true
on suppliersdropdown
, time selection made, products list updated accordingly.
Comments
Post a Comment