M
mamun
Hi All,
I have the following situation.
In the aspx page, I have a datagrid and getting values from the
database.
I am displaying checkbox in each row of the grid. At the top of the
grid I have an "Update" button which will be used to update the
contents based on Bore_Id field. This field in the database is Number
type.
Here is the snippet of my code in page.aspx. The name (or id) of the
datagrid is BoreHolesResult. I will be updating based on the selected
checkbox and this checkbox should relate to the field Bore_Id.
<asp:TemplateColumn HeaderText="Type" >
<ItemTemplate>
<asp:TextBox ID="txtType" Runat="server" text='<
%#DataBinder.Eval(Container.DataItem, "BORE_TYPE") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<HeaderTemplate>
<asp:Button ID="btnUpdateBoreId" Runat="server" Text="Update"
Onclick="UpdateBoreID"></asp:Button>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID='chkid' enabled='<
%#((System.Data.DataRowView)Container.DataItem)["BORE_ID"].ToString()
%>'
Runat="server">
</asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
In the code file (page.aspx.cs),
I have the following:
public void UpdateBoreID(object sender, EventArgs e) //, string
BoreID
{
foreach (DataGridItem item in
BoreHolesResult.Items)
{
string BoreType;
CheckBox cb =
(CheckBox)BoreHolesResult.Items[8].FindControl("chkid");
if (cb.Checked == true)
{
BoreType =
((TextBox)item.FindControl("txtType")).Text;
Response.Write(BoreType);
}
}
}
I am having problem and the build is failed saying cannot convert
string to bool.
I have been struggling with this for the last two days. I will highly
appreciate if you could help me.
Thanks a ton in advance.
best regards,
mamun
I have the following situation.
In the aspx page, I have a datagrid and getting values from the
database.
I am displaying checkbox in each row of the grid. At the top of the
grid I have an "Update" button which will be used to update the
contents based on Bore_Id field. This field in the database is Number
type.
Here is the snippet of my code in page.aspx. The name (or id) of the
datagrid is BoreHolesResult. I will be updating based on the selected
checkbox and this checkbox should relate to the field Bore_Id.
<asp:TemplateColumn HeaderText="Type" >
<ItemTemplate>
<asp:TextBox ID="txtType" Runat="server" text='<
%#DataBinder.Eval(Container.DataItem, "BORE_TYPE") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<HeaderTemplate>
<asp:Button ID="btnUpdateBoreId" Runat="server" Text="Update"
Onclick="UpdateBoreID"></asp:Button>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID='chkid' enabled='<
%#((System.Data.DataRowView)Container.DataItem)["BORE_ID"].ToString()
%>'
Runat="server">
</asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
In the code file (page.aspx.cs),
I have the following:
public void UpdateBoreID(object sender, EventArgs e) //, string
BoreID
{
foreach (DataGridItem item in
BoreHolesResult.Items)
{
string BoreType;
CheckBox cb =
(CheckBox)BoreHolesResult.Items[8].FindControl("chkid");
if (cb.Checked == true)
{
BoreType =
((TextBox)item.FindControl("txtType")).Text;
Response.Write(BoreType);
}
}
}
I am having problem and the build is failed saying cannot convert
string to bool.
I have been struggling with this for the last two days. I will highly
appreciate if you could help me.
Thanks a ton in advance.
best regards,
mamun