Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Sir, I have an id named Docket no. When it Enter the Docketno the details in that table corresponding to that table comes to the textBox. Suppose , I have To get the entry in 5 text boxes. in the 5 textbox it will again get an id from where it will fill 2 text boxes.This should be done without Button.I have Done this Using Buttons
I will Be happy If this can be done using Java Script.
Thanks If Some One helps me with Code

protected void Page_Load(object sender, EventArgs e)
{
{
String DocketNo = Docket_No.Text;
String Branch= From_STN.Text;
String Date = Date_Time.Text;
SqlConnection conn;
SqlCommand comm;
SqlDataReader reader;
string connnectionString = ConfigurationManager.ConnectionStrings["amitpandeyConnectionString"].ConnectionString;
conn = new SqlConnection(connnectionString);
if (Docket_No.Text == "") // IF match the scan ID
{


comm = new SqlCommand(@"SELECT Branch,Date,DocketNo Where Branch = @Branch and Date =@date and DocketNo = @DocketNo", conn);
}
conn.Open();
comm.Parameters.AddWithValue("@Branch", To_STN.Text);
comm.Parameters.AddWithValue("@date", Date_Time.Text);
comm.Parameters.AddWithValue(" @DocketNo", Docket_No.Text);
reader = comm.ExecuteReader();

reader.Close();
conn.Close();
}
}
Posted
Updated 14-Nov-14 0:01am
v4

1 solution

 
Share this answer
 
Comments
Member 11111143 14-Nov-14 5:47am    
Sir, When I enter the id in the text boxes then if its correct then it will fill other textboxes details
String DocketNo = Docket_No.Text;
String Branch= From_STN.Text;
String Date = Date_Time.Text;
String PinCode = Pin_Code1.Text;
String Basis= Bassis.Text;
String To = To_STN.Text;
String ConsignorCode = Consignor_Code.Text;
String Consignee = Consignee_code.Text;
String PKTS = No_of_PKG.Text;
String ActWt = Actual_Wt.Text;
String ChargeWt = Charge_Wt.Text;
String TotalFreight = Grand_Total.Text;
String GoodsType= PKG_Type.Text;
String CODamount = COD.Text;
SqlConnection conn;
SqlCommand comm;
SqlDataReader reader;
string connnectionString = ConfigurationManager.ConnectionStrings["amitpandeyConnectionString"].ConnectionString;
conn = new SqlConnection(connnectionString);
if (Docket_No.Text == "") // IF match the scan ID
{


comm = new SqlCommand(@"SELECT Branch,Date,DocketNo,PinCode,basis,To,ConsignorCode,Consigee,PKTS,ActWT,ChargeWt,TotalFreight,GoodsType,CODamount FROM CraeteDocket Where Branch = @Branch and Date =@date and DocketNo = @DocketNo and PinCode = @PinCode and Basis = @basis and To = @To and ConsignorCode = @ConsignorCode and Consigee = @Consignee and PKTS = @PKTS and ActWt = @ActWt and ChargeWT = @ChargeWT and TotalFreight = @TotalFreight and GoodsType = @GoodsType and CODamount = @CODamount", conn);
}


conn.Open();



conn.Close();
}
Member 11111143 14-Nov-14 5:48am    
But Sir This is not Working
Mathew Soji 14-Nov-14 5:53am    
Is there an error that you are getting or nothing?
Did you write code in text box change event where auto post back is set to true ?
Member 11111143 14-Nov-14 6:39am    
comm, is an unassigned variable.
Is the way i am doing this stuff alright

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