i have been able to creat different method for inserting the two different IDs, now my challenge is on txtcommentpost in Datalist GetUSERCOMMENT2, i want to insert CommentID Column of TABLE A into table B ID column, i tried to do so and its not inserting, it can only insert ID Column of A table into CommentID Column of B table.
Code for Datalist GetUSERCOMMENT2
TextBox textBox = sender as TextBox;
Label label = sender as Label;
if (textBox.ID == "txtcommentpost")
{
// int comment2ID = Convert.ToInt32((textBox.NamingContainer.FindControl("lblId2") as Label).Text);
int lblcomid = Convert.ToInt32((textBox.NamingContainer.FindControl("LBLCOM") as Label).Text);
string comment = textBox.Text.Trim();
string name = (textBox.NamingContainer.FindControl("lblnestname") as Label).Text;
string username = (textBox.NamingContainer.FindControl("lblshId") as Label).Text;
string imagename = (textBox.NamingContainer.FindControl("FImageName2") as Label).Text;
Insert(lblcomid, comment, name, username, imagename, "PostComment2");
-----------------------------
<asp:DataList ID="GetUSERCOMMENTS2" runat="server" OnItemDataBound="GetUSERCOMMENTS2_ItemDataBound" Width="100%">
<ItemTemplate>
<div class="media-left" style="">
</div>
<article class="timeline-entry">
<div class="timeline-entry-inner">
<div class="timeline-icon bg-warning " style="">
<i class="entypo-feather">
</i>
</div>
<div class="timeline-label">
<h2 style="margin-bottom:2px"><a href="#" style=" margin-bottom:2px">
<asp:Label ID="lblfname" Text='<%#Eval("fName") %>' CssClass="" runat="server" Font-Bold="True" Font-Names="Arial" ForeColor="Black" Font-Size="Smaller" />
<asp:Label ID="lblUserNamecom" Text='<%#Eval("UserName") %>' CssClass="" runat="server" Font-Bold="True" Font-Names="Arial" ForeColor="Gray" Font-Size="Smaller" />
</a>
</h2>
<span>
<asp:Label ID="LBLCOM" runat="server" Text='<%#Eval("CommentID") %>' Visible="true" />
// <asp:Label ID="lblId2" runat="server" Text='<%#Eval("ID") %>' Visible="false" />
<asp:Label ID="lblComments2" runat="server" Text='<%#Eval("Comments") %>' ForeColor="#333333" CssClass="" Font-Names="Arial" Font-Size="Smaller" Font-Bold="False" />
</span>
Post Table
ID Username Posts
10 mic22 hello world
--------------------------------
Comment A table
CommentID Comments ID
4 Nice one 10
----------------------------------
Comment B table
ID Comment2 CommentID
8 i like that 1