T
tnt_lu
I have a parent datagrid that has my customer information. For each
customer I have a child datagrid with all their part information. In
the child datagrid I have 4 radio buttons plus databound part
information. The radio buttons are not bound by data. They are
different selection types that will dictate how each part information
will be saved.
This is what I have currently:
C#.net - HTML
*****************************************************************
<asp:datagrid id="DataGrid1" runat="server" Width="100%"
AutoGenerateColumns="False" CellSpacing="0"
CellPadding="0" ShowHeader="False">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<TABLE id="tblMain" cellSpacing="0" cellPadding="0" width="100%"
border="0">
<TR class="TableHead3">
<TD><B>End Customer:
<%# DataBinder.Eval(Container.DataItem, "ENDCUST") %>
</B>
</TR>
<TR>
<TD colSpan="2">
<TABLE id="tblDetail" cellSpacing="0" cellPadding="0"
width="100%" border="0">
<tr>
<td align="right">
<asp
ataGrid id=DataGrid2 runat="server"
AutoGenerateColumns="False" BorderStyle="None" BorderWidth="1px"
BackColor="White" CellPadding="1" GridLines="Vertical"
DataKeyField="CUSTOMERPARTID" OnItemDataBound="DataGrid2_ItemDataBound"
DataSource='<%# GetChildRelation(Container.DataItem,"relCustomerPart")
%>'>
<HeaderStyle Font-Bold="True"
CssClass="TableHead"></HeaderStyle>
<AlternatingItemStyle
CssClass="TblRow2"></AlternatingItemStyle>
<ItemStyle ForeColor="Black" CssClass="TblAlt2"></ItemStyle>
<Columns>
<asp:TemplateColumn>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<HeaderTemplate>
<asp:Label id="Label1"
runat="server">Unchanged</asp:Label> <A id="AllUnchanged"
class="Cursor" onclick="SetRadioDataGrid('rdoUnchanged',this.id);">
<FONT color="yellow" size="1"><U>
<BR>
All</U></FONT></A>
</HeaderTemplate>
<ItemTemplate>
<asp:RadioButton id="rdoUnchanged" runat="server"
GroupName="rbType" Checked="True"></asp:RadioButton>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<HeaderTemplate>
<asp:Label id="Label2"
runat="server">Revise</asp:Label><A id="AllRevised" class="Cursor"
onclick="SetRadioDataGrid('rdoRevised',this);"><FONT color="yellow"
size="1"><U><BR>
All</U></FONT></A>
</HeaderTemplate>
<ItemTemplate>
<asp:RadioButton id="rdoRevised" runat="server"
GroupName="rbType"></asp:RadioButton>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<HeaderTemplate>
<asp:Label id="Label3"
runat="server">Reference</asp:Label><A id="AllReferenced"
class="Cursor" onclick="SetRadioDataGrid('rdoReferenced',this);"><FONT
color="yellow" size="1"><U><BR>
All</U></FONT></A>
</HeaderTemplate>
<ItemTemplate>
<asp:RadioButton id="rdoReferenced" runat="server"
GroupName="rbType"></asp:RadioButton>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<HeaderTemplate>
<asp:Label id="Label4"
runat="server">Replace</asp:Label><A id="AllReplaced" class="Cursor"
onclick="SetRadioDataGrid('rdoReplaced',this);"><FONT color="yellow"
size="1"><U><BR>
All</U></FONT></A>
</HeaderTemplate>
<ItemTemplate>
<asp:RadioButton id="rdoReplaced" runat="server"
GroupName="rbType"></asp:RadioButton>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<HeaderTemplate>
<asp:Label id="Label5"
runat="server">Select</asp:Label><A id="AllSelect" class="Cursor"
onclick="SetRadioDataGrid('chkSelect',this);"><FONT color="yellow"
size="1"><U><BR>
All</U></FONT></A>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox id="chkSelect"
runat="server"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn Visible="False" DataField="CUSTOMERPARTID"
ReadOnly="True"></asp:BoundColumn>
<asp:BoundColumn DataField="ENDCUST_PART_NBR"
HeaderText="End Customer P/N">
<HeaderStyle Font-Bold="True" HorizontalAlign="Center"
ForeColor="White"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="STATUS" HeaderText="Status">
<HeaderStyle Font-Bold="True" HorizontalAlign="Center"
ForeColor="White"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="Year" HeaderText="Model Year">
<HeaderStyle Font-Bold="True" HorizontalAlign="Center"
ForeColor="White"></HeaderStyle>
</asp:BoundColumn>
</Columns>
</asp
ataGrid>
</td>
</tr>
</TABLE>
</TD>
</TR>
</TABLE>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
*****************************************************************
aspx.cs
DataTable dtCustInfo = ds.Tables["tblCustomerInfo"];
DataTable dtCustParts = ds.Tables["tblCustomerParts"];
ds.Relations.Clear();
DataRelation relCustomerPart =
ds.Relations.Add("relCustomerPart",dtCustInfo.Columns["CUSTOMERPARTID"],dtCustParts.Columns["CUSTOMERPARTID"]);
DataView dvCustInfo = new
DataView(dtCustInfo,"","",DataViewRowState.CurrentRows);
DataView dvCustParts;
this.DataGrid1.DataSource = dvCustInfo;
this.DataGrid1.DataBind();
*************************************************************
What I want to do is have a button on top of the form that will save
the child part information dependant on the selection of the radio
buttons. I can't seem to use the "FindControl" method for the page to
try to map a radio button control also since the Child Datagrid is in a
template, I can't seem to loop through the child datagrid either. Any
help would be great. I think the key is to be able to read my child
datagrid somehow.
Thanks in advance:
Todd
customer I have a child datagrid with all their part information. In
the child datagrid I have 4 radio buttons plus databound part
information. The radio buttons are not bound by data. They are
different selection types that will dictate how each part information
will be saved.
This is what I have currently:
C#.net - HTML
*****************************************************************
<asp:datagrid id="DataGrid1" runat="server" Width="100%"
AutoGenerateColumns="False" CellSpacing="0"
CellPadding="0" ShowHeader="False">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<TABLE id="tblMain" cellSpacing="0" cellPadding="0" width="100%"
border="0">
<TR class="TableHead3">
<TD><B>End Customer:
<%# DataBinder.Eval(Container.DataItem, "ENDCUST") %>
</B>
</TR>
<TR>
<TD colSpan="2">
<TABLE id="tblDetail" cellSpacing="0" cellPadding="0"
width="100%" border="0">
<tr>
<td align="right">
<asp
AutoGenerateColumns="False" BorderStyle="None" BorderWidth="1px"
BackColor="White" CellPadding="1" GridLines="Vertical"
DataKeyField="CUSTOMERPARTID" OnItemDataBound="DataGrid2_ItemDataBound"
DataSource='<%# GetChildRelation(Container.DataItem,"relCustomerPart")
%>'>
<HeaderStyle Font-Bold="True"
CssClass="TableHead"></HeaderStyle>
<AlternatingItemStyle
CssClass="TblRow2"></AlternatingItemStyle>
<ItemStyle ForeColor="Black" CssClass="TblAlt2"></ItemStyle>
<Columns>
<asp:TemplateColumn>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<HeaderTemplate>
<asp:Label id="Label1"
runat="server">Unchanged</asp:Label> <A id="AllUnchanged"
class="Cursor" onclick="SetRadioDataGrid('rdoUnchanged',this.id);">
<FONT color="yellow" size="1"><U>
<BR>
All</U></FONT></A>
</HeaderTemplate>
<ItemTemplate>
<asp:RadioButton id="rdoUnchanged" runat="server"
GroupName="rbType" Checked="True"></asp:RadioButton>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<HeaderTemplate>
<asp:Label id="Label2"
runat="server">Revise</asp:Label><A id="AllRevised" class="Cursor"
onclick="SetRadioDataGrid('rdoRevised',this);"><FONT color="yellow"
size="1"><U><BR>
All</U></FONT></A>
</HeaderTemplate>
<ItemTemplate>
<asp:RadioButton id="rdoRevised" runat="server"
GroupName="rbType"></asp:RadioButton>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<HeaderTemplate>
<asp:Label id="Label3"
runat="server">Reference</asp:Label><A id="AllReferenced"
class="Cursor" onclick="SetRadioDataGrid('rdoReferenced',this);"><FONT
color="yellow" size="1"><U><BR>
All</U></FONT></A>
</HeaderTemplate>
<ItemTemplate>
<asp:RadioButton id="rdoReferenced" runat="server"
GroupName="rbType"></asp:RadioButton>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<HeaderTemplate>
<asp:Label id="Label4"
runat="server">Replace</asp:Label><A id="AllReplaced" class="Cursor"
onclick="SetRadioDataGrid('rdoReplaced',this);"><FONT color="yellow"
size="1"><U><BR>
All</U></FONT></A>
</HeaderTemplate>
<ItemTemplate>
<asp:RadioButton id="rdoReplaced" runat="server"
GroupName="rbType"></asp:RadioButton>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<HeaderTemplate>
<asp:Label id="Label5"
runat="server">Select</asp:Label><A id="AllSelect" class="Cursor"
onclick="SetRadioDataGrid('chkSelect',this);"><FONT color="yellow"
size="1"><U><BR>
All</U></FONT></A>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox id="chkSelect"
runat="server"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn Visible="False" DataField="CUSTOMERPARTID"
ReadOnly="True"></asp:BoundColumn>
<asp:BoundColumn DataField="ENDCUST_PART_NBR"
HeaderText="End Customer P/N">
<HeaderStyle Font-Bold="True" HorizontalAlign="Center"
ForeColor="White"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="STATUS" HeaderText="Status">
<HeaderStyle Font-Bold="True" HorizontalAlign="Center"
ForeColor="White"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="Year" HeaderText="Model Year">
<HeaderStyle Font-Bold="True" HorizontalAlign="Center"
ForeColor="White"></HeaderStyle>
</asp:BoundColumn>
</Columns>
</asp
</td>
</tr>
</TABLE>
</TD>
</TR>
</TABLE>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
*****************************************************************
aspx.cs
DataTable dtCustInfo = ds.Tables["tblCustomerInfo"];
DataTable dtCustParts = ds.Tables["tblCustomerParts"];
ds.Relations.Clear();
DataRelation relCustomerPart =
ds.Relations.Add("relCustomerPart",dtCustInfo.Columns["CUSTOMERPARTID"],dtCustParts.Columns["CUSTOMERPARTID"]);
DataView dvCustInfo = new
DataView(dtCustInfo,"","",DataViewRowState.CurrentRows);
DataView dvCustParts;
this.DataGrid1.DataSource = dvCustInfo;
this.DataGrid1.DataBind();
*************************************************************
What I want to do is have a button on top of the form that will save
the child part information dependant on the selection of the radio
buttons. I can't seem to use the "FindControl" method for the page to
try to map a radio button control also since the Child Datagrid is in a
template, I can't seem to loop through the child datagrid either. Any
help would be great. I think the key is to be able to read my child
datagrid somehow.
Thanks in advance:
Todd