P
paul.mcmanus.uk
Hi all,
I'm using a datagrid to display and update information from several
tables in SQL Server.
I've created my SQL SELECT statement with the necessary INNER JOINs and
this works correctly when displaying the data but for some reason when
i edit one of the rows two copies of each row are displayed.
my SELECT statement is as follows:
SELECT imgSubjJUNCTid, imageID, kw_subject_lv1.subjectLv1_desc,
kw_subject_lv2.subjectLv2_desc FROM junct_subject INNER JOIN
kw_subject_lv1 ON junct_subject.subj_Lv1_ID =
kw_subject_lv1.subjectLv1_ID INNER JOIN kw_subject_lv2 ON
junct_subject.subj_Lv2_ID = kw_subject_lv2.subjectLv2_ID WHERE
junct_subject.imageID = "+imgID
my datagrid code is:
<aspataGrid ID="dgSubjects" runat="server"
AutoGenerateColumns="false" OnEditCommand="dg_edit"
OnCancelCommand="dg_cancel" OnUpdateCommand="dg_update"
ShowHeader="false">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "imgSubjJUNCTid") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id="imgSubjJunct_ID" Text='<%#
DataBinder.Eval(Container.DataItem, "imgSubjJUNCTid") %>'
runat="server" />
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "subjectLv1_desc") %>
</ItemTemplate>
<EditItemTemplate>
<aspropDownList ID="ddl_subject1" runat="server" DataSource='<%#
getSubjectLv1() %>' DataTextField="subjectLv1_desc"
DataValueField="subjectLv1_ID" OnSelectedIndexChanged='subjectFilter'
/>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "subjectLv2_desc") %>
</ItemTemplate>
<EditItemTemplate>
<aspropDownList ID="ddl_subject2" runat="server" DataSource='<%#
getSubjectLv2() %>' DataTextField="subjectLv2_desc"
DataValueField="subjectLv2_ID" />
</EditItemTemplate>
</asp:TemplateColumn>
<asp:EditCommandColumn EditText="Edit" UpdateText="OK"
CancelText="Cancel"/>
</Columns>
</aspataGrid>
does anyone have any experience of a similar problem,
any ideas would be appreciated, thanks in advance
Paul
I'm using a datagrid to display and update information from several
tables in SQL Server.
I've created my SQL SELECT statement with the necessary INNER JOINs and
this works correctly when displaying the data but for some reason when
i edit one of the rows two copies of each row are displayed.
my SELECT statement is as follows:
SELECT imgSubjJUNCTid, imageID, kw_subject_lv1.subjectLv1_desc,
kw_subject_lv2.subjectLv2_desc FROM junct_subject INNER JOIN
kw_subject_lv1 ON junct_subject.subj_Lv1_ID =
kw_subject_lv1.subjectLv1_ID INNER JOIN kw_subject_lv2 ON
junct_subject.subj_Lv2_ID = kw_subject_lv2.subjectLv2_ID WHERE
junct_subject.imageID = "+imgID
my datagrid code is:
<aspataGrid ID="dgSubjects" runat="server"
AutoGenerateColumns="false" OnEditCommand="dg_edit"
OnCancelCommand="dg_cancel" OnUpdateCommand="dg_update"
ShowHeader="false">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "imgSubjJUNCTid") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id="imgSubjJunct_ID" Text='<%#
DataBinder.Eval(Container.DataItem, "imgSubjJUNCTid") %>'
runat="server" />
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "subjectLv1_desc") %>
</ItemTemplate>
<EditItemTemplate>
<aspropDownList ID="ddl_subject1" runat="server" DataSource='<%#
getSubjectLv1() %>' DataTextField="subjectLv1_desc"
DataValueField="subjectLv1_ID" OnSelectedIndexChanged='subjectFilter'
/>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "subjectLv2_desc") %>
</ItemTemplate>
<EditItemTemplate>
<aspropDownList ID="ddl_subject2" runat="server" DataSource='<%#
getSubjectLv2() %>' DataTextField="subjectLv2_desc"
DataValueField="subjectLv2_ID" />
</EditItemTemplate>
</asp:TemplateColumn>
<asp:EditCommandColumn EditText="Edit" UpdateText="OK"
CancelText="Cancel"/>
</Columns>
</aspataGrid>
does anyone have any experience of a similar problem,
any ideas would be appreciated, thanks in advance
Paul