|
So where is the problem?
Apurva Kaushal
|
|
|
|
|
i cant save the gridview values in the databse...
|
|
|
|
|
i am using empty gridrow in my webpage
|
|
|
|
|
How exactly are you trying to insert the value in your database? Are you getting any problem in accessing the value of the textbox or getting the problem in inserting the data into the database?
Apurva Kaushal
|
|
|
|
|
i am getting error while inserting into the database.. shall i send my coding to u
|
|
|
|
|
What is that error?
Apurva Kaushal
|
|
|
|
|
i am getting this error: procedure r function not specified for @part_Number..
|
|
|
|
|
Are you attaching the parameter correctly to the command object?
Apurva Kaushal
|
|
|
|
|
this s my gridview desingn:
<asp:templatefield headertext="Part Number">
<itemtemplate>
<asp:textbox backcolor="AliceBlue" id="txtPartNumber" runat="server" text="<%# Bind("Part_Number") %>">
<asp:templatefield headertext="Part Description">
<itemtemplate>
<asp:textbox backcolor="AliceBlue" id="txtPartDescription" runat="server" text="<%# Bind("Part_Description") %>">
<asp:templatefield headertext="Ordered Quantity">
<itemtemplate>
<asp:textbox backcolor="AliceBlue" id="txtOrderedQuantity" runat="server" text="<%# Bind("Ordered_Quantity") %>">
<asp:templatefield headertext="ReceivedQuantity">
<itemtemplate>
<asp:textbox backcolor="AliceBlue" id="txtReceivedQuantity" runat="server">
|
|
|
|
|
Put you code in code tag. Then it will be visible properly.
Apurva Kaushal
|
|
|
|
|
hi good morning..
private void BindGrid()
{
List<ItemEntry> items = new List<ItemEntry>();
for (int i = 0; i < 50; i++)
{
ItemEntry c = new ItemEntry();
items.Add(c);
}
grdPurEntry.DataSource = items;
grdPurEntry.DataBind();
}
public void PON_selectedIndexChanged(object src, EventArgs e)
{
string strPONumber;
strPONumber = ddlpurchaseOrdernumber.SelectedItem.Text.ToString();
//BindData();
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["connectionstring"].ToString());
SqlCommand cmd = new SqlCommand("select MachineName from tbl_PurchaseOrderMaster where Pur_Order_No='" + strPONumber + "'", con);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
// ddlpurchaseOredernumber.Items.Clear();
while (dr.Read())
{
txtMachineName.Text = dr["MachineName"].ToString();
//txtInvoiceNum.Text = dr["Invoice_No"].ToString();
}
con.Close();
// Load Grid
//string strPONumber;
//strPONumber = ddlpurchaseOrdernumber.SelectedItem.Text.ToString();
string strPartNumber = "";
string strPartDescription = "";
string strOrderedQuantity = "";
//SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString());
SqlDataAdapter ad = new SqlDataAdapter("SELECT Part_Number,Part_Description,Ordered_Quantity FROM tbl_PurchaseOrderDetails where Pur_Order_No ='" + strPONumber + "'", con);// where MachineName='" + txtMachineName.Text + "'", con);
DataSet ds = new DataSet();
ad.Fill(ds, "PurOrderNum");
DataTable dt = ds.Tables[0];
foreach (DataRow dr1 in dt.Rows)
{
strPartNumber = dr1["Part_Number"].ToString();
strPartDescription = dr1["Part_Description"].ToString();
strOrderedQuantity = dr1["Ordered_Quantity"].ToString();
}
//string strPONumber;
//strPONumber = ddlpurchaseOrdernumber.SelectedItem.Text.ToString();
foreach (GridViewRow row in grdPurEntry.Rows)
{
if (row.RowType == DataControlRowType.DataRow)
{
if (String.IsNullOrEmpty(((TextBox)row.FindControl("txtPartNumber")).Text))
{
((TextBox)row.FindControl("txtPartNumber")).Text = strPartNumber.ToString();
if (strPartDescription != "")
{
((TextBox)row.FindControl("txtPartDescription")).Text = strPartDescription.ToString();
}
if (strOrderedQuantity != "")
{
((TextBox)row.FindControl("txtOrderedQuantity")).Text = strOrderedQuantity.ToString();
}
// else
//{
// ((TextBox)row.FindControl("txtOrderedQuantity")).Text;// = "0";
//}
ddlpurchaseOrdernumber.SelectedIndex = 0;
return;
}
}
}
// ddlpurchaseOrdernumber.SelectedIndex = 0;
}
while clicking the dropdown box i have to bind the values to the gridview .. but it s not working ...
protected void btnSave_Click(object src, EventArgs e)
{
try{
Cls_PurchaseEntry purent = new Cls_PurchaseEntry();
purent.Pur_Order_No = Convert.ToInt32(ddlpurchaseOrdernumber.SelectedItem.Value.ToString());
purent.Invoice_No = Convert.ToInt32(txtInvoiceNum.Text);
purent.MachineName = txtMachineName.Text;
foreach (GridViewRow row in grdPurEntry.Rows)
{
if (row.RowType == DataControlRowType.DataRow)
{
string Part_Number = ((TextBox)row.FindControl("txtPartNumber")).Text;
purent.Part_Number = Part_Number;
string Part_Description = ((TextBox)row.FindControl("txtPartDescription")).Text;
purent.Part_Description = Part_Description;
string Ordered_Quantity = ((TextBox)row.FindControl("txtOrderedQuantity")).Text;
purent.Ordered_Quantity =Convert.ToInt32(Ordered_Quantity);
string Received_Quantity = ((TextBox)row.FindControl("txtReceivedQuantity")).Text;
if (Received_Quantity != "")
{
purent.Received_Quantity = Convert.ToInt32(Received_Quantity);
}
// purent.Part_Number = Part_Number;
//purent.Part_Description = Part_Description;
//purent.Ordered_Quantity = Convert.ToInt32(Ordered_Quantity);
// purent.Received_Quantity = Convert.ToInt32(Received_Quantity);
purent.User_Created = Session["Name"].ToString();
purent.User_Modified = Session["Name"].ToString();
purent.Date_Created = Convert.ToDateTime(txtDate.Text);
purent.Date_Modified = Convert.ToDateTime(txtDate.Text);
IMMS_SaveUtility immsUtil = new IMMS_SaveUtility();
string n = immsUtil.savePurchaseEntry(purent);
}
}
lbldispm.Text = "PurchaseEntry added successfully!";
}
catch (Exception ex)
{
lbldispm.Text = "Error completing the operation!";
}
}
|
|
|
|
|
yardly wrote: iam having 4 textbox inside my gridview
Ok
yardly wrote: already i am having 3 textbox outside the gridview
How many textboxes are there?
please be clear whats your requirement.
please don't forget to vote on the post that helped you.
|
|
|
|
|
totally i am having 7 txtbox .
but i cant insert it into my table
|
|
|
|
|
have you bound the gridview with some datasource?
please don't forget to vote on the post that helped you.
|
|
|
|
|
no i didnt bound with datasource
|
|
|
|
|
So you have to bind it first.
Can you tell me what exactly you want
please don't forget to vote on the post that helped you.
|
|
|
|
|
i have binded gridview like this
<asp:templatefield headertext="Part Number">
<itemtemplate>
<asp:textbox backcolor="AliceBlue" id="txtPartNumber" runat="server" text="<%# Bind("Part_Number") %>">
<asp:templatefield headertext="Part Description">
<itemtemplate>
<asp:textbox backcolor="AliceBlue" id="txtPartDescription" runat="server" text="<%# Bind("Part_Description") %>">
<asp:templatefield headertext="Ordered Quantity">
<itemtemplate>
<asp:textbox backcolor="AliceBlue" id="txtOrderedQuantity" runat="server" text="<%# Bind("Ordered_Quantity") %>">
<asp:templatefield headertext="ReceivedQuantity">
<itemtemplate>
<asp:textbox backcolor="AliceBlue" id="txtReceivedQuantity" runat="server">
|
|
|
|
|
<asp:templatefield headertext="Part Number">
<itemtemplate>
<asp:textbox backcolor="AliceBlue" id="txtPartNumber" runat="server" text="<%# Bind("Part_Number") %>">
<asp:templatefield headertext="Part Description">
<itemtemplate>
<asp:textbox backcolor="AliceBlue" id="txtPartDescription" runat="server" text="<%# Bind("Part_Description") %>">
<asp:templatefield headertext="Ordered Quantity">
<itemtemplate>
<asp:textbox backcolor="AliceBlue" id="txtOrderedQuantity" runat="server" text="<%# Bind("Ordered_Quantity") %>">
<asp:templatefield headertext="ReceivedQuantity">
<itemtemplate>
<asp:textbox backcolor="AliceBlue" id="txtReceivedQuantity" runat="server">
|
|
|
|
|
|
check "Ignore HTML tags in this message (good for code snippets)" check box and then post your code
please don't forget to vote on the post that helped you.
|
|
|
|
|
hi good morning..
private void BindGrid()
{
List<ItemEntry> items = new List<ItemEntry>();
for (int i = 0; i < 50; i++)
{
ItemEntry c = new ItemEntry();
items.Add(c);
}
grdPurEntry.DataSource = items;
grdPurEntry.DataBind();
}
public void PON_selectedIndexChanged(object src, EventArgs e)
{
string strPONumber;
strPONumber = ddlpurchaseOrdernumber.SelectedItem.Text.ToString();
//BindData();
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["connectionstring"].ToString());
SqlCommand cmd = new SqlCommand("select MachineName from tbl_PurchaseOrderMaster where Pur_Order_No='" + strPONumber + "'", con);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
// ddlpurchaseOredernumber.Items.Clear();
while (dr.Read())
{
txtMachineName.Text = dr["MachineName"].ToString();
//txtInvoiceNum.Text = dr["Invoice_No"].ToString();
}
con.Close();
// Load Grid
//string strPONumber;
//strPONumber = ddlpurchaseOrdernumber.SelectedItem.Text.ToString();
string strPartNumber = "";
string strPartDescription = "";
string strOrderedQuantity = "";
//SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString());
SqlDataAdapter ad = new SqlDataAdapter("SELECT Part_Number,Part_Description,Ordered_Quantity FROM tbl_PurchaseOrderDetails where Pur_Order_No ='" + strPONumber + "'", con);// where MachineName='" + txtMachineName.Text + "'", con);
DataSet ds = new DataSet();
ad.Fill(ds, "PurOrderNum");
DataTable dt = ds.Tables[0];
foreach (DataRow dr1 in dt.Rows)
{
strPartNumber = dr1["Part_Number"].ToString();
strPartDescription = dr1["Part_Description"].ToString();
strOrderedQuantity = dr1["Ordered_Quantity"].ToString();
}
//string strPONumber;
//strPONumber = ddlpurchaseOrdernumber.SelectedItem.Text.ToString();
foreach (GridViewRow row in grdPurEntry.Rows)
{
if (row.RowType == DataControlRowType.DataRow)
{
if (String.IsNullOrEmpty(((TextBox)row.FindControl("txtPartNumber")).Text))
{
((TextBox)row.FindControl("txtPartNumber")).Text = strPartNumber.ToString();
if (strPartDescription != "")
{
((TextBox)row.FindControl("txtPartDescription")).Text = strPartDescription.ToString();
}
if (strOrderedQuantity != "")
{
((TextBox)row.FindControl("txtOrderedQuantity")).Text = strOrderedQuantity.ToString();
}
// else
//{
// ((TextBox)row.FindControl("txtOrderedQuantity")).Text;// = "0";
//}
ddlpurchaseOrdernumber.SelectedIndex = 0;
return;
}
}
}
// ddlpurchaseOrdernumber.SelectedIndex = 0;
}
while clicking the dropdown box i have to bind the values to the gridview .. but it s not working ...
protected void btnSave_Click(object src, EventArgs e)
{
try{
Cls_PurchaseEntry purent = new Cls_PurchaseEntry();
purent.Pur_Order_No = Convert.ToInt32(ddlpurchaseOrdernumber.SelectedItem.Value.ToString());
purent.Invoice_No = Convert.ToInt32(txtInvoiceNum.Text);
purent.MachineName = txtMachineName.Text;
foreach (GridViewRow row in grdPurEntry.Rows)
{
if (row.RowType == DataControlRowType.DataRow)
{
string Part_Number = ((TextBox)row.FindControl("txtPartNumber")).Text;
purent.Part_Number = Part_Number;
string Part_Description = ((TextBox)row.FindControl("txtPartDescription")).Text;
purent.Part_Description = Part_Description;
string Ordered_Quantity = ((TextBox)row.FindControl("txtOrderedQuantity")).Text;
purent.Ordered_Quantity =Convert.ToInt32(Ordered_Quantity);
string Received_Quantity = ((TextBox)row.FindControl("txtReceivedQuantity")).Text;
if (Received_Quantity != "")
{
purent.Received_Quantity = Convert.ToInt32(Received_Quantity);
}
// purent.Part_Number = Part_Number;
//purent.Part_Description = Part_Description;
//purent.Ordered_Quantity = Convert.ToInt32(Ordered_Quantity);
// purent.Received_Quantity = Convert.ToInt32(Received_Quantity);
purent.User_Created = Session["Name"].ToString();
purent.User_Modified = Session["Name"].ToString();
purent.Date_Created = Convert.ToDateTime(txtDate.Text);
purent.Date_Modified = Convert.ToDateTime(txtDate.Text);
IMMS_SaveUtility immsUtil = new IMMS_SaveUtility();
string n = immsUtil.savePurchaseEntry(purent);
}
}
lbldispm.Text = "PurchaseEntry added successfully!";
}
catch (Exception ex)
{
lbldispm.Text = "Error completing the operation!";
}
}
|
|
|
|
|
hi i have a 2 aspx pages. parent page has a IFRAME tag inside which i open the child page...
in the child page i show a asp calender control, on selecting a calendar control i need to get the selected date to the main parent page text box. it is not happening now....
//////////// parent.aspx............
function Show()
{
document.getElementById('myFrame').src= "/workingwebsite/calendar.aspx?formname=frmCalendar.txtDate";
document.all.myFrame.style.visibility="visible";
}
any help plzzzzz..................thanks a million in advance.......
|
|
|
|
|
Hey Chandler,
ASP Calendar Control doesn't support Client Script by it one. To achieve your requirement,
* You have to handle the click of each day
Or
* Wait until it PostBack and store the date in some Hidden Field. Get the Hidden Field value on Page Load of the Child Page.
|
|
|
|
|
Hi
i am developing a web application in which i want to populate two dropdownlist.
In first dropdownlist i want to populate with country's name and if we select any country, then it should give the list of states in the another dropdownlist and if we select any state then the textbox should place with the capitals and so on...
If possible send me code, its very urgent
Thank you in advance
raghu
|
|
|
|
|
you can use Icallback event handler. get it Demo ,Source code
bEst rEgard
pAthan
please don't forget to vote on the post that helped you.
|
|
|
|