DropDownList in DataGrid EditItemTemplate Return Error

Discussion in 'ASP .Net Datagrid Control' started by rsw8n, Nov 26, 2003.

  1. rsw8n

    rsw8n Guest

    I have a dropdown list in the edititem template of a data grid. I
    have no problems populating the dropdown box when I click edit.
    However, if I edit and select a different item in the dropdown list I
    always get the top value in the list returned in my UpdateCommand
    event. Below is my code:

    private void BindCurrentActivityGrid(string strVendorid)
    {
    DataSet ds;

    SqlParameter [] param = new SqlParameter[1];
    SqlParameter spparm = new SqlParameter();

    spparm.ParameterName = "@vendorid";
    spparm.Value = strVendorid;
    spparm.SqlDbType = SqlDbType.Char;

    param[0] = spparm;

    ds = SqlHelper.ExecuteDataset(ConfigurationSettings.AppSettings["connStr"],
    CommandType.StoredProcedure,
    "uspCurrentActivities_GetByVendorId",
    param);

    DataView dv = new DataView();
    dv = ds.Tables[0].DefaultView;
    dgCurrentActivities.DataSource = dv;
    dgCurrentActivities.DataBind();
    }

    private void UpdateCurrentActivityGrid(string strValue,string
    iStatus)
    {
    SqlParameter [] param = new SqlParameter[2];
    SqlParameter spparm = new SqlParameter();

    spparm.ParameterName = "@ponumber";
    spparm.Value = strValue;
    spparm.SqlDbType = SqlDbType.VarChar;
    param[0] = spparm;

    SqlParameter spparm1 = new SqlParameter();
    spparm1.Value = Convert.ToInt32(iStatus);
    spparm1.ParameterName = "@status";
    spparm1.SqlDbType = SqlDbType.SmallInt;
    param[1] = spparm1;

    SqlHelper.ExecuteNonQuery(ConfigurationSettings.AppSettings["connStr"],
    CommandType.StoredProcedure,
    "uspPOStatus_Update",param);

    }
    #region Web Form Designer generated code
    override protected void OnInit(EventArgs e)
    {
    //
    // CODEGEN: This call is required by the ASP.NET Web Form Designer.
    //
    InitializeComponent();
    base.OnInit(e);
    }

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
    this.dgCurrentActivities.CancelCommand += new
    System.Web.UI.WebControls.DataGridCommandEventHandler(this.OnCancel);
    this.dgCurrentActivities.EditCommand += new
    System.Web.UI.WebControls.DataGridCommandEventHandler(this.OnEdit);
    this.dgCurrentActivities.UpdateCommand += new
    System.Web.UI.WebControls.DataGridCommandEventHandler(this.OnUpdate);
    this.dgCurrentActivities.ItemDataBound += new
    System.Web.UI.WebControls.DataGridItemEventHandler(this.dgItemDataBound);
    this.dgCurrentActivities.SelectedIndexChanged += new
    System.EventHandler(this.Changed);
    this.Load += new System.EventHandler(this.Page_Load);

    }
    #endregion

    private void GetStatusCodes()
    {

    SqlParameter [] param = new SqlParameter[1];
    SqlParameter spparm = new SqlParameter();

    dsStatusCodes = SqlHelper.ExecuteDataset(ConfigurationSettings.AppSettings["connStr"],
    CommandType.StoredProcedure,
    "uspStatusCode_GetAll");

    }

    private void OnEdit(object source,
    System.Web.UI.WebControls.DataGridCommandEventArgs e)
    {
    DropDownList dl = new DropDownList();
    ListItemType lit = new ListItemType();

    lit = e.Item.ItemType;

    GetStatusCodes();
    // dl = (DropDownList)(e.Item.Cells[3].FindControl("ddStatus"));
    // dl.DataSource = dsStatusCodes;
    // dl.DataTextField = "POStatusCdDescription";
    // dl.DataValueField = "POStatusId";


    dgCurrentActivities.EditItemIndex = e.Item.ItemIndex;
    BindCurrentActivityGrid(strVendor);
    }

    private void OnUpdate(object source,
    System.Web.UI.WebControls.DataGridCommandEventArgs e)
    {
    DropDownList dl = new DropDownList();
    string strStatus;
    string strPO;
    ListItemType lit = new ListItemType();

    lit = e.Item.ItemType;

    if (lit == ListItemType.EditItem)
    {
    strPO = dgCurrentActivities.DataKeys[e.Item.ItemIndex].ToString();
    dl = (DropDownList)(e.Item.FindControl("ddStatus"));
    strStatus = dl.SelectedItem.Text.ToString();
    }

    dgCurrentActivities.EditItemIndex = -1;
    BindCurrentActivityGrid(strVendor);

    }

    private void OnCancel(object source,
    System.Web.UI.WebControls.DataGridCommandEventArgs e)
    {
    dgCurrentActivities.EditItemIndex=-1;
    BindCurrentActivityGrid(strVendor);
    }

    private void dgItemDataBound(object sender,
    System.Web.UI.WebControls.DataGridItemEventArgs e)
    { DropDownList dl = new DropDownList();
    ListItemType lit = new ListItemType();
    lit = e.Item.ItemType;

    if (lit == ListItemType.EditItem)
    {
    dl = (DropDownList)(e.Item.FindControl("ddStatus"));
    dl.DataTextField = "POStatusCdDescription";
    dl.DataValueField = "POStatusId";
    dl.DataSource = dsStatusCodes;
    dl.DataBind();
    }
    }

    private void Changed(object sender, System.EventArgs e)
    {
    string strtest;

    strtest = e.ToString();
    }

    The above Changed function is supposed to be called when the
    SelectedIndexChanged event is fired in the datagrid.
    Below is my asp.net stuff:

    <asp:DataGrid id="dgCurrentActivities" runat="server"
    AutoGenerateColumns="False" DataKeyField="ponumber">
    <Columns>
    <asp:HyperLinkColumn Target="_self"
    DataNavigateUrlField="ponumber"
    DataNavigateUrlFormatString="PODetail.aspx?{0}"
    DataTextField="ponumber" HeaderText="PO
    #"></asp:HyperLinkColumn>
    <asp:BoundColumn DataField="lotnumber" HeaderText="Lot #"
    ReadOnly =true></asp:BoundColumn>
    <asp:BoundColumn DataField="description"
    HeaderText="Description" ReadOnly =true></asp:BoundColumn>
    <asp:TemplateColumn HeaderText="Status">
    <ItemTemplate>
    <asp:Label id=lblStatusCodes runat="server" Width="65px"
    Text='<%#DataBinder.Eval(Container.DataItem, "status") %>'>
    </asp:Label>
    </ItemTemplate>
    <EditItemTemplate>
    <asp:DropDownList id="ddStatus"
    runat="server"></asp:DropDownList>
    </EditItemTemplate>
    </asp:TemplateColumn>
    <asp:EditCommandColumn ButtonType="LinkButton"
    UpdateText="Update" CancelText="Cancel"
    EditText="Edit"></asp:EditCommandColumn>
    </Columns>
    </asp:DataGrid>

    Any insight would be greatly appreciated.

    rsw8n
    rsw8n, Nov 26, 2003
    #1
    1. Advertising

  2. You should create property for example Global class that can you access for
    receive Connection String:

    public class Global

    {

    ....

    public static string ConnectionString

    {
    get
    {
    return ConfigurationSettings.AppSettings["connStr"];
    }
    }

    }

    private void BindCurrentActivityGrid(string strVendorid)
    {
    SqlDataAdapter cmd = new
    SqlDataAdapter("uspCurrentActivities_GetByVendorId", new
    SqlConnection(Global.ConnectionString))
    cmd.SelectCommand.CommadType = CommadType.StorageProcedure;
    cmd.SelectCommand.Parameters.Add("@vendorid", strVendorid);

    DataSet ds = new DataSet();
    cmd.Fill(ds);

    dg.DataSourse = ds.Tables[0].DefaultView;
    dg.DataBind();
    }

    private void OnEdit(object source,
    System.Web.UI.WebControls.DataGridCommandEventArgs e)
    {
    dg.EditItemIndex = e.Item.ItemIndex;
    BindCurrentActivityGrid("");

    DropDownList dl =
    ((DropDownList)dgdUsers.Items[e.Item.ItemIndex].Cells[2].FindControl("ddStat
    us"));
    dl.DataSourse = GetStatus();
    dl.DataBind();
    dl.Items.FinfByValue("...").Selected = true;
    }

    private DateView GetStatus()
    {
    SqlDataAdapter cmd = new SqlDataAdapter("...", new
    SqlConnection(Global.ConnectionString))
    cmd.SelectCommand.CommadType = CommadType.StorageProcedure;

    DataSet ds = new DataSet();
    cmd.Fill(ds);

    return ds.Tables[0].DefaultView;
    }

    <asp:TemplateColumn HeaderText="Status">
    <ItemTemplate>
    <%#DataBinder.Eval(Container.DataItem, "status") %>
    </ItemTemplate>
    <EditItemTemplate>
    <asp:DropDownList id="ddStatus" runat="server"
    DataTextField="POStatusCdDescription"
    DataValueField="POStatusId"></asp:DropDownList>
    </EditItemTemplate>
    </asp:TemplateColumn>

    The Best Regards,
    Web Developer
    Michael Tkachev

    "rsw8n" <> wrote in message
    news:...
    > I have a dropdown list in the edititem template of a data grid. I
    > have no problems populating the dropdown box when I click edit.
    > However, if I edit and select a different item in the dropdown list I
    > always get the top value in the list returned in my UpdateCommand
    > event. Below is my code:
    >
    > private void BindCurrentActivityGrid(string strVendorid)
    > {
    > DataSet ds;
    >
    > SqlParameter [] param = new SqlParameter[1];
    > SqlParameter spparm = new SqlParameter();
    >
    > spparm.ParameterName = "@vendorid";
    > spparm.Value = strVendorid;
    > spparm.SqlDbType = SqlDbType.Char;
    >
    > param[0] = spparm;
    >
    > ds =

    SqlHelper.ExecuteDataset(ConfigurationSettings.AppSettings["connStr"],
    > CommandType.StoredProcedure,
    > "uspCurrentActivities_GetByVendorId",
    > param);
    >
    > DataView dv = new DataView();
    > dv = ds.Tables[0].DefaultView;
    > dgCurrentActivities.DataSource = dv;
    > dgCurrentActivities.DataBind();
    > }
    >
    > private void UpdateCurrentActivityGrid(string strValue,string
    > iStatus)
    > {
    > SqlParameter [] param = new SqlParameter[2];
    > SqlParameter spparm = new SqlParameter();
    >
    > spparm.ParameterName = "@ponumber";
    > spparm.Value = strValue;
    > spparm.SqlDbType = SqlDbType.VarChar;
    > param[0] = spparm;
    >
    > SqlParameter spparm1 = new SqlParameter();
    > spparm1.Value = Convert.ToInt32(iStatus);
    > spparm1.ParameterName = "@status";
    > spparm1.SqlDbType = SqlDbType.SmallInt;
    > param[1] = spparm1;
    >
    > SqlHelper.ExecuteNonQuery(ConfigurationSettings.AppSettings["connStr"],
    > CommandType.StoredProcedure,
    > "uspPOStatus_Update",param);
    >
    > }
    > #region Web Form Designer generated code
    > override protected void OnInit(EventArgs e)
    > {
    > //
    > // CODEGEN: This call is required by the ASP.NET Web Form Designer.
    > //
    > InitializeComponent();
    > base.OnInit(e);
    > }
    >
    > /// <summary>
    > /// Required method for Designer support - do not modify
    > /// the contents of this method with the code editor.
    > /// </summary>
    > private void InitializeComponent()
    > {
    > this.dgCurrentActivities.CancelCommand += new
    > System.Web.UI.WebControls.DataGridCommandEventHandler(this.OnCancel);
    > this.dgCurrentActivities.EditCommand += new
    > System.Web.UI.WebControls.DataGridCommandEventHandler(this.OnEdit);
    > this.dgCurrentActivities.UpdateCommand += new
    > System.Web.UI.WebControls.DataGridCommandEventHandler(this.OnUpdate);
    > this.dgCurrentActivities.ItemDataBound += new
    > System.Web.UI.WebControls.DataGridItemEventHandler(this.dgItemDataBound);
    > this.dgCurrentActivities.SelectedIndexChanged += new
    > System.EventHandler(this.Changed);
    > this.Load += new System.EventHandler(this.Page_Load);
    >
    > }
    > #endregion
    >
    > private void GetStatusCodes()
    > {
    >
    > SqlParameter [] param = new SqlParameter[1];
    > SqlParameter spparm = new SqlParameter();
    >
    > dsStatusCodes =

    SqlHelper.ExecuteDataset(ConfigurationSettings.AppSettings["connStr"],
    > CommandType.StoredProcedure,
    > "uspStatusCode_GetAll");
    >
    > }
    >
    > private void OnEdit(object source,
    > System.Web.UI.WebControls.DataGridCommandEventArgs e)
    > {
    > DropDownList dl = new DropDownList();
    > ListItemType lit = new ListItemType();
    >
    > lit = e.Item.ItemType;
    >
    > GetStatusCodes();
    > // dl = (DropDownList)(e.Item.Cells[3].FindControl("ddStatus"));
    > // dl.DataSource = dsStatusCodes;
    > // dl.DataTextField = "POStatusCdDescription";
    > // dl.DataValueField = "POStatusId";
    >
    >
    > dgCurrentActivities.EditItemIndex = e.Item.ItemIndex;
    > BindCurrentActivityGrid(strVendor);
    > }
    >
    > private void OnUpdate(object source,
    > System.Web.UI.WebControls.DataGridCommandEventArgs e)
    > {
    > DropDownList dl = new DropDownList();
    > string strStatus;
    > string strPO;
    > ListItemType lit = new ListItemType();
    >
    > lit = e.Item.ItemType;
    >
    > if (lit == ListItemType.EditItem)
    > {
    > strPO = dgCurrentActivities.DataKeys[e.Item.ItemIndex].ToString();
    > dl = (DropDownList)(e.Item.FindControl("ddStatus"));
    > strStatus = dl.SelectedItem.Text.ToString();
    > }
    >
    > dgCurrentActivities.EditItemIndex = -1;
    > BindCurrentActivityGrid(strVendor);
    >
    > }
    >
    > private void OnCancel(object source,
    > System.Web.UI.WebControls.DataGridCommandEventArgs e)
    > {
    > dgCurrentActivities.EditItemIndex=-1;
    > BindCurrentActivityGrid(strVendor);
    > }
    >
    > private void dgItemDataBound(object sender,
    > System.Web.UI.WebControls.DataGridItemEventArgs e)
    > { DropDownList dl = new DropDownList();
    > ListItemType lit = new ListItemType();
    > lit = e.Item.ItemType;
    >
    > if (lit == ListItemType.EditItem)
    > {
    > dl = (DropDownList)(e.Item.FindControl("ddStatus"));
    > dl.DataTextField = "POStatusCdDescription";
    > dl.DataValueField = "POStatusId";
    > dl.DataSource = dsStatusCodes;
    > dl.DataBind();
    > }
    > }
    >
    > private void Changed(object sender, System.EventArgs e)
    > {
    > string strtest;
    >
    > strtest = e.ToString();
    > }
    >
    > The above Changed function is supposed to be called when the
    > SelectedIndexChanged event is fired in the datagrid.
    > Below is my asp.net stuff:
    >
    > <asp:DataGrid id="dgCurrentActivities" runat="server"
    > AutoGenerateColumns="False" DataKeyField="ponumber">
    > <Columns>
    > <asp:HyperLinkColumn Target="_self"
    > DataNavigateUrlField="ponumber"
    > DataNavigateUrlFormatString="PODetail.aspx?{0}"
    > DataTextField="ponumber" HeaderText="PO
    > #"></asp:HyperLinkColumn>
    > <asp:BoundColumn DataField="lotnumber" HeaderText="Lot #"
    > ReadOnly =true></asp:BoundColumn>
    > <asp:BoundColumn DataField="description"
    > HeaderText="Description" ReadOnly =true></asp:BoundColumn>
    > <asp:TemplateColumn HeaderText="Status">
    > <ItemTemplate>
    > <asp:Label id=lblStatusCodes runat="server" Width="65px"
    > Text='<%#DataBinder.Eval(Container.DataItem, "status") %>'>
    > </asp:Label>
    > </ItemTemplate>
    > <EditItemTemplate>
    > <asp:DropDownList id="ddStatus"
    > runat="server"></asp:DropDownList>
    > </EditItemTemplate>
    > </asp:TemplateColumn>
    > <asp:EditCommandColumn ButtonType="LinkButton"
    > UpdateText="Update" CancelText="Cancel"
    > EditText="Edit"></asp:EditCommandColumn>
    > </Columns>
    > </asp:DataGrid>
    >
    > Any insight would be greatly appreciated.
    >
    > rsw8n
    Michael Tkachev, Nov 27, 2003
    #2
    1. Advertising

  3. rsw8n

    rsw8n Guest

    Michael,

    Thanks for your reply however it does not address my issue. I did
    change my data access to methods similar to yours just incase the
    Application block I am using was causing some unknown issue but I
    achieved the same results.

    Let me explain my issue again. I can populate the dropdown box in a
    edittemplate correctly. I can even have the dropdown preselect the
    correct value returned from my database. However, I cannot capture
    the selected value when I edit the column. It always updated the
    column to the first item in the list regardless of what was originally
    returned from the database and what I select when it is in edit mode.
    Steps I have taken are:

    1. To add an event handler in the itemcreated event of the data grid
    as follows:
    DropDownList dl = new DropDownList();

    if (e.Item.ItemType == ListItemType.EditItem)
    {
    dl = (DropDownList)e.Item.FindControl("ddStatus");
    dl.SelectedIndexChanged += new System.EventHandler(this.Changed);
    }

    2. I have placed breaks on the dropdownlist databind method in the
    itemdatabound event and it does not break during the update. I was
    suspecting the dropdown was being redatabound (new word) before the
    update but it does not appear to be.

    3. In the update event I made a for loop that will loop through each
    item in the dropdownlist and set break points in the for loop to read
    each individual value in the dropdown list. Neither of them ever has
    a selected value set to true. I hoped step one above would allow me
    to capture the value but the selectedindexchanged event never fires.
    (I have breaks in there that are not within any conditions.).

    I have my edit and update event functions set to rebind the datagrid
    in the last step of the event. I also bind the datagrid if it is not
    a postback.

    (rsw8n) wrote in message news:<>...
    > I have a dropdown list in the edititem template of a data grid. I
    > have no problems populating the dropdown box when I click edit.
    > However, if I edit and select a different item in the dropdown list I
    > always get the top value in the list returned in my UpdateCommand
    > event. Below is my code:
    >
    > private void BindCurrentActivityGrid(string strVendorid)
    > {
    > DataSet ds;
    >
    > SqlParameter [] param = new SqlParameter[1];
    > SqlParameter spparm = new SqlParameter();
    >
    > spparm.ParameterName = "@vendorid";
    > spparm.Value = strVendorid;
    > spparm.SqlDbType = SqlDbType.Char;
    >
    > param[0] = spparm;
    >
    > ds = SqlHelper.ExecuteDataset(ConfigurationSettings.AppSettings["connStr"],
    > CommandType.StoredProcedure,
    > "uspCurrentActivities_GetByVendorId",
    > param);
    >
    > DataView dv = new DataView();
    > dv = ds.Tables[0].DefaultView;
    > dgCurrentActivities.DataSource = dv;
    > dgCurrentActivities.DataBind();
    > }
    >
    > private void UpdateCurrentActivityGrid(string strValue,string
    > iStatus)
    > {
    > SqlParameter [] param = new SqlParameter[2];
    > SqlParameter spparm = new SqlParameter();
    >
    > spparm.ParameterName = "@ponumber";
    > spparm.Value = strValue;
    > spparm.SqlDbType = SqlDbType.VarChar;
    > param[0] = spparm;
    >
    > SqlParameter spparm1 = new SqlParameter();
    > spparm1.Value = Convert.ToInt32(iStatus);
    > spparm1.ParameterName = "@status";
    > spparm1.SqlDbType = SqlDbType.SmallInt;
    > param[1] = spparm1;
    >
    > SqlHelper.ExecuteNonQuery(ConfigurationSettings.AppSettings["connStr"],
    > CommandType.StoredProcedure,
    > "uspPOStatus_Update",param);
    >
    > }
    > #region Web Form Designer generated code
    > override protected void OnInit(EventArgs e)
    > {
    > //
    > // CODEGEN: This call is required by the ASP.NET Web Form Designer.
    > //
    > InitializeComponent();
    > base.OnInit(e);
    > }
    >
    > /// <summary>
    > /// Required method for Designer support - do not modify
    > /// the contents of this method with the code editor.
    > /// </summary>
    > private void InitializeComponent()
    > {
    > this.dgCurrentActivities.CancelCommand += new
    > System.Web.UI.WebControls.DataGridCommandEventHandler(this.OnCancel);
    > this.dgCurrentActivities.EditCommand += new
    > System.Web.UI.WebControls.DataGridCommandEventHandler(this.OnEdit);
    > this.dgCurrentActivities.UpdateCommand += new
    > System.Web.UI.WebControls.DataGridCommandEventHandler(this.OnUpdate);
    > this.dgCurrentActivities.ItemDataBound += new
    > System.Web.UI.WebControls.DataGridItemEventHandler(this.dgItemDataBound);
    > this.dgCurrentActivities.SelectedIndexChanged += new
    > System.EventHandler(this.Changed);
    > this.Load += new System.EventHandler(this.Page_Load);
    >
    > }
    > #endregion
    >
    > private void GetStatusCodes()
    > {
    >
    > SqlParameter [] param = new SqlParameter[1];
    > SqlParameter spparm = new SqlParameter();
    >
    > dsStatusCodes = SqlHelper.ExecuteDataset(ConfigurationSettings.AppSettings["connStr"],
    > CommandType.StoredProcedure,
    > "uspStatusCode_GetAll");
    >
    > }
    >
    > private void OnEdit(object source,
    > System.Web.UI.WebControls.DataGridCommandEventArgs e)
    > {
    > DropDownList dl = new DropDownList();
    > ListItemType lit = new ListItemType();
    >
    > lit = e.Item.ItemType;
    >
    > GetStatusCodes();
    > // dl = (DropDownList)(e.Item.Cells[3].FindControl("ddStatus"));
    > // dl.DataSource = dsStatusCodes;
    > // dl.DataTextField = "POStatusCdDescription";
    > // dl.DataValueField = "POStatusId";
    >
    >
    > dgCurrentActivities.EditItemIndex = e.Item.ItemIndex;
    > BindCurrentActivityGrid(strVendor);
    > }
    >
    > private void OnUpdate(object source,
    > System.Web.UI.WebControls.DataGridCommandEventArgs e)
    > {
    > DropDownList dl = new DropDownList();
    > string strStatus;
    > string strPO;
    > ListItemType lit = new ListItemType();
    >
    > lit = e.Item.ItemType;
    >
    > if (lit == ListItemType.EditItem)
    > {
    > strPO = dgCurrentActivities.DataKeys[e.Item.ItemIndex].ToString();
    > dl = (DropDownList)(e.Item.FindControl("ddStatus"));
    > strStatus = dl.SelectedItem.Text.ToString();
    > }
    >
    > dgCurrentActivities.EditItemIndex = -1;
    > BindCurrentActivityGrid(strVendor);
    >
    > }
    >
    > private void OnCancel(object source,
    > System.Web.UI.WebControls.DataGridCommandEventArgs e)
    > {
    > dgCurrentActivities.EditItemIndex=-1;
    > BindCurrentActivityGrid(strVendor);
    > }
    >
    > private void dgItemDataBound(object sender,
    > System.Web.UI.WebControls.DataGridItemEventArgs e)
    > { DropDownList dl = new DropDownList();
    > ListItemType lit = new ListItemType();
    > lit = e.Item.ItemType;
    >
    > if (lit == ListItemType.EditItem)
    > {
    > dl = (DropDownList)(e.Item.FindControl("ddStatus"));
    > dl.DataTextField = "POStatusCdDescription";
    > dl.DataValueField = "POStatusId";
    > dl.DataSource = dsStatusCodes;
    > dl.DataBind();
    > }
    > }
    >
    > private void Changed(object sender, System.EventArgs e)
    > {
    > string strtest;
    >
    > strtest = e.ToString();
    > }
    >
    > The above Changed function is supposed to be called when the
    > SelectedIndexChanged event is fired in the datagrid.
    > Below is my asp.net stuff:
    >
    > <asp:DataGrid id="dgCurrentActivities" runat="server"
    > AutoGenerateColumns="False" DataKeyField="ponumber">
    > <Columns>
    > <asp:HyperLinkColumn Target="_self"
    > DataNavigateUrlField="ponumber"
    > DataNavigateUrlFormatString="PODetail.aspx?{0}"
    > DataTextField="ponumber" HeaderText="PO
    > #"></asp:HyperLinkColumn>
    > <asp:BoundColumn DataField="lotnumber" HeaderText="Lot #"
    > ReadOnly =true></asp:BoundColumn>
    > <asp:BoundColumn DataField="description"
    > HeaderText="Description" ReadOnly =true></asp:BoundColumn>
    > <asp:TemplateColumn HeaderText="Status">
    > <ItemTemplate>
    > <asp:Label id=lblStatusCodes runat="server" Width="65px"
    > Text='<%#DataBinder.Eval(Container.DataItem, "status") %>'>
    > </asp:Label>
    > </ItemTemplate>
    > <EditItemTemplate>
    > <asp:DropDownList id="ddStatus"
    > runat="server"></asp:DropDownList>
    > </EditItemTemplate>
    > </asp:TemplateColumn>
    > <asp:EditCommandColumn ButtonType="LinkButton"
    > UpdateText="Update" CancelText="Cancel"
    > EditText="Edit"></asp:EditCommandColumn>
    > </Columns>
    > </asp:DataGrid>
    >
    > Any insight would be greatly appreciated.
    >
    > rsw8n
    rsw8n, Nov 28, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. George Durzi

    DropDownList in EditItemTemplate

    George Durzi, Sep 27, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    8,500
    George Durzi
    Sep 27, 2004
  2. =?Utf-8?B?Tkg=?=
    Replies:
    2
    Views:
    29,316
    =?Utf-8?B?Tkg=?=
    Mar 27, 2006
  3. WT
    Replies:
    2
    Views:
    4,571
  4. Steve Hershoff
    Replies:
    2
    Views:
    819
    Steve Hershoff
    Apr 11, 2007
  5. Steve Hershoff

    DataGrid EditItemTemplate-- how to retrieve a DropDownList validator?

    Steve Hershoff, Apr 11, 2007, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    901
    Steve Hershoff
    Apr 11, 2007
Loading...

Share This Page