<asp:panel id="PanelOutDCItemDetails" runat="server">
<asp:gridview id="gvOutDCItemDetails" runat="server" allowpaging="True"
="" pagesize="6" autogeneratecolumns="False" onrowdatabound="gvOutDCItemDetails_RowDataBound" onrowcommand="gvOutDCItemDetails_RowCommand" onselectedindexchanged="gvOutDCItemDetails_SelectedIndexChanged" backcolor="White" bordercolor="White" borderstyle="Ridge" borderwidth="2px" cellpadding="3" cellspacing="1" gridlines="None" datakeynames="Item_Id">
<columns>
<asp:commandfield showdeletebutton="True">
<asp:boundfield headertext="Item Id" datafield="Item_Id">
<asp:boundfield headertext="Item Name" datafield="IName">
<asp:boundfield headertext="Net Quantity" datafield="I_Quantity">
<asp:boundfield datafield="Remaining_Qty" headertext="Remaining Quantity">
<asp:templatefield headertext="Process">
<itemtemplate>
<asp:dropdownlist id="ddrProcess" runat="server">
<asp:templatefield headertext="Dispatch Quantity">
<itemtemplate>
<asp:textbox id="txtDispatchQuantity" runat="server" autopostback="true" ontextchanged="TextChanged_txtDispatchQuantity">
<asp:templatefield headertext="Remaining Quantity">
<itemtemplate>
<asp:textbox id="txtRamainingQuantity" runat="server">
<asp:templatefield headertext="Rate">
<itemtemplate>
<asp:textbox id="txtRate" runat="server" autopostback="true" ontextchanged="txtRate_TextChanged">
<asp:templatefield headertext="Amount">
<itemtemplate>
<asp:textbox id="txtAmount" runat="server">
<asp:templatefield>
<itemtemplate>
<asp:label id="lblStatus" runat="server" text="Status">
<footerstyle backcolor="#C6C3C6" forecolor="Black">
<headerstyle backcolor="#4A3C8C" font-bold="True" forecolor="#E7E7FF">
<pagerstyle backcolor="#C6C3C6" forecolor="Black" horizontalalign="Right">
<rowstyle backcolor="#DEDFDE" forecolor="Black">
<selectedrowstyle backcolor="#9471DE" font-bold="True" forecolor="White">
<sortedascendingcellstyle backcolor="#F1F1F1">
<sortedascendingheaderstyle backcolor="#594B9C">
<sorteddescendingcellstyle backcolor="#CAC9C9">
<sorteddescendingheaderstyle backcolor="#33276A">
<selectedrowstyle backcolor="#9471DE" font-bold="True" forecolor="White">
Here is my C# code
protected void gvOutDC_SelectedIndexChanged1(object sender, EventArgs e)
{
if (gvOutDC.SelectedIndex >= 0)
{
btnsave.Enabled = false;
btnInword.Visible = false;
OutDC.Visible = true;
OutDCItemDetails.Visible = true;
View.Visible = false;
InwordDetails.Visible = false;
txtOutId.Visible = true;
txtoutCode.Enabled = false;
btn.Visible = true;
txtcustcode.Enabled = false;
btnsave.Enabled = true;
txtOutId.Text = gvOutDC.SelectedDataKey[0].ToString();
txtoutCode.Text = gvOutDC.SelectedRow.Cells[2].Text.ToString();
txtDate.Text =gvOutDC.SelectedRow.Cells[8].Text.ToString();
txtCustomerId.Text = gvOutDC.SelectedRow.Cells[5].Text.ToString();
txtcustcode.Text = gvOutDC.SelectedRow.Cells[7].Text.ToString();
txtCustomerName.Text = gvOutDC.SelectedRow.Cells[6].Text.ToString();
int inworditem = Convert.ToInt16(gvOutDC.SelectedRow.Cells[3].Text.ToString());
SqlCommand cmd = new SqlCommand("sp_getOutDCmaterialDetail",con1);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@outDCid", txtOutId.Text);
cmd.Parameters.AddWithValue("@inwordItem", inworditem);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
con1.Open();
gvOutDCItemDetails.DataSource = ds;
gvOutDCItemDetails.DataBind();
OutDCItemDetails.Visible = true;
}
}
protected void gvOutDCItemDetails_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DropDownList ddList = (DropDownList)e.Row.FindControl("ddrProcess");
SqlCommand cmd = new SqlCommand("sp_getProcess", con1);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
DataTable dt = ds.Tables[0];
ddList.DataSource = dt;
ddList.DataTextField = "PName";
ddList.DataValueField = "Process_Id";
ddList.DataBind();
ddList.Items.Insert(0,new ListItem("--SELECT--","0"));
TextBox txtDispatchQuantity = (TextBox)e.Row.FindControl("txtDispatchQuantity");
txtDispatchQuantity.Text = ds.Tables[0].Rows[0][3].ToString();
TextBox txtRamainingQuantity = (TextBox)e.Row.FindControl("txtRamainingQuantity");
txtRamainingQuantity.Text = ds.Tables[0].Rows[0][3].ToString();
TextBox txtRate = (TextBox)e.Row.FindControl("txtRate");
txtRate.Text = ds.Tables[0].Rows[0][3].ToString();
TextBox txtAmount = (TextBox)e.Row.FindControl("txtAmount");
txtAmount.Text = ds.Tables[0].Rows[0][3].ToString();
}
if (e.Row.RowType == DataControlRowType.Footer)
{
}
}
for update record in my OutWordChallan Page
On selectedindexchaged i want to set vaues of textbox in item template of gridview ...
using dataset ...
but how can i assign vaues when we actually dont know how many rows in my dataset
please help me thr this
really thankfull