Hi, I am trying to bind into a FormTemplate for editing from a GridBoundColumn 'value' where on ItemDataBound I pulled the information from multiple other columns in my Data Table (value_int, value_string, value_bit). For each row only one column would have information and the rest are null.
I haven't been able to figure out how to populate the textbox from 'value' let alone eventually write this back. Another thing I have tried other than (unsuccessfully) getting the data from the 'value' column in my grid was to use bind() for each column in the data table as such:
<
asp:TextBox
ID
=
"txtBoxValue"
runat
=
"server"
Text='<%# Bind("Value_string") ?? Bind("value_decimal18_2") ?? Bind("value_bit") %>'></
asp:TextBox
>
But this only binds whatever value_bit shows as either true/false or a space as it doesn't seem to be a null. code behind to bind the 'value' column is the following:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem && e.Item != null)
{
GridDataItem item = (GridDataItem)e.Item;
DataRowView drv = (DataRowView)e.Item.DataItem;
if (drv["value_type"] != null)
{
if ((string)drv["value_type"] == "value_string")
{
item["Value"].Text = drv["value_string"].ToString();
}
else if ((string)drv["value_type"] == "value_bigint")
{
item["Value"].Text = drv["value_bigint"].ToString();
}
else if ((string)drv["value_type"] == "value_decimal18_2")
{
item["Value"].Text = drv["value_decimal18_2"].ToString();
}
else if ((string)drv["value_type"] == "value_bit")
{
item["Value"].Text = drv["value_bit"].ToString();
}
}
}