I have a datalist that displays all records from table but i have a button select on the datalist and i want to use the button to select each record of the column and display it on modal
here is my code
GetPost2(username);
}
}
public void GetPost2(string username)
{
// int followerid;
// int followingid;
string str = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
string getADPOST = "GetMessage";
using (SqlConnection con = new SqlConnection(str))
{
con.Open();
using (SqlCommand cmd = new SqlCommand(getADPOST, con))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@UserName", username);
// cmd.Parameters.AddWithValue("@Name", username);
// cmd.Parameters.AddWithValue("@FriendUserName", username);
// cmd.Parameters.AddWithValue("@FollowingId", follower);
//
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable ds = new DataTable();
da.Fill(ds);
ShowPost.DataSource = ds;
ShowPost.DataBind();
}
}
}
HTML
<!-- Modal share category -->
<div class="modal fade" id="myModal9t" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header" style="background-color:#31b0d5">
<button type="buttonclose" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title" style="color:white">BroadCast this to friends</h4>
</div>
<div class="modal-body">
<div class="col-sm-12">
<p >
<asp:TextBox ID="TextBox2" runat="server" placeholder="Add Comment... " TextMode="MultiLine" CssClass="form-control" Height="80px"></asp:TextBox>
</p>
<br />
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:FormView ID="ShowPost" runat="server" CssClass=" table table-bordered table-striped table-hover">
<ItemTemplate>
<!-- Conversations are loaded here -->
<div class="">
<!-- Message. Default to the left -->
<div class="" style="margin-bottom:1px; margin-left:8px; margin-top:8px; margin-right:8px">
<div class=" " style="">
<ul class="media-list">
<li class="media">
<a class="pull-left" href='<%#getUserHREF1(Container.DataItem)%>'>
<img src='<%#getSRC(Container.DataItem)%>' class="media-object img-circle img-rounded animated bounce" style="border: medium solid #CCCCFF; width:50px; height:50px; " />
</a>
<div class="media-body" >
<h5 class="media-heading">
<a class="pull-left" href='<%#getUserHREF1(Container.DataItem)%>'>
<asp:Label ID="Label2" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Name") %>' Font-Bold="True " ForeColor="#666666" />
</a>
<i style="margin-right:2px; margin-left:2px; color:Silver" class="fa fa-play"></i>
<asp:Label ID="Label11" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"FriendUserName") %>' Font-Bold="True " ForeColor="Silver" />
<br />
<asp:Label ID="Label3" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "SendDate","{0:dddd,MMMM dd,yyyy}" ) %>' Font-Size="X-Small" Font-Bold="True" ForeColor="Gray" />
<div class="clearfix" ></div>
</h5>
<asp:Label ID="lblSendDate" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"ContentPost")%>' Font-Names="Comic Sans MS" ></asp:Label>
<asp:HyperLink ID="HyperLink1" runat="server">Read More...</asp:HyperLink>
<div class=" col-lg-12" style="margin-bottom:2px;margin-top:2px">
<a href='<%#getUserHREF2(Container.DataItem)%>' class="">
<img src='<%#getSRCDD(Container.DataItem)%>' class="img-rounded img-responsive" style=" width:100%" alt="" />
</a>
</div>
<div class=" col-lg-12" style="margin-top:2px;margin-bottom:2px ">
<div class=" col-lg-6" style="margin-top:2px">
<a href='<%#getUserHREF4(Container.DataItem)%>' class="">
<img src='<%#getSRC4(Container.DataItem)%>' class="img-rounded img-responsive" style=" width:50%" alt="" />
</a>
</div>
<div class=" col-lg-6" style="margin-top:2px">
<a href='<%#getUserHREF5(Container.DataItem)%>' class="">
<img src='<%#getSRC5(Container.DataItem)%>' class="img-rounded img-responsive" style=" width:100%" alt="" />
</a>
</div>
</div>
<!-- Nested media object -->
</div>
</li>
</ul>
</div>
</div><!--/.direct-chat-messages-->
<!-- Contacts are loaded here -->
</div><!-- /.box-body -->
</ItemTemplate>
</asp:FormView>
</ContentTemplate>
<Triggers>
</Triggers>
</asp:UpdatePanel>
</div>
</div>
<div class="clearfix"></div>
<div class="modal-footer">
<asp:LinkButton ID="LinkButton6" runat="server" CssClass="btn btn-twitter" Font-Bold="True"><i class="fa fa-share-square-o" style="font-weight: bold; margin-right:3px; font-size: large;"></i>BroadCast</asp:LinkButton>
</div>
</div>
</div>
</div>
<!-- Trigger the modal with a button -->