C
cook.jonathan.m
I want to programmatically add a dropdown to each row in a certain
column returned to the gridview by my query. I want to do this
entirely in behind-code. My gridview tag in the page will have the
following code and no more.
<asp:GridView ID="gv" runat="server"
AutoGenerateColumns="false">
</asp:GridView>
Now, I have generated boundfields to add regular data without a
control to the gridview.
Example:
foreach (DataColumn col in tempTable.Columns)
{
BoundField bField = new BoundField();
bField.HtmlEncode = false;
bField.DataField = col.ColumnName.ToString();
bField.HeaderText = col.ColumnName.ToString();
gv.Columns.Add(bField);
}
That's fine, but in one of these columns that comes back, I want it to
contain a dropdownlist that could be filled from a separate sql query
and also have this column be editable.
I've referenced http://www.dotnet247.com/247reference/msgs/13/65435.aspx
and doing such with a dropdownlist, instead of a button doesn't kill
off my page, but it also does not load my dropdownlist.
Any ideas?
-Jonathan
column returned to the gridview by my query. I want to do this
entirely in behind-code. My gridview tag in the page will have the
following code and no more.
<asp:GridView ID="gv" runat="server"
AutoGenerateColumns="false">
</asp:GridView>
Now, I have generated boundfields to add regular data without a
control to the gridview.
Example:
foreach (DataColumn col in tempTable.Columns)
{
BoundField bField = new BoundField();
bField.HtmlEncode = false;
bField.DataField = col.ColumnName.ToString();
bField.HeaderText = col.ColumnName.ToString();
gv.Columns.Add(bField);
}
That's fine, but in one of these columns that comes back, I want it to
contain a dropdownlist that could be filled from a separate sql query
and also have this column be editable.
I've referenced http://www.dotnet247.com/247reference/msgs/13/65435.aspx
and doing such with a dropdownlist, instead of a button doesn't kill
off my page, but it also does not load my dropdownlist.
Any ideas?
-Jonathan