Hi micah,
I have modified code as per your requirement. So please refer the below code and you need to set height and width as per your requirement.
HTML
<div>
<asp:TextBox ID="txtUrl" placeholder="Enter your Url" Width="370px" runat="server" />
<br />
<asp:TextBox ID="txttitle" placeholder="Enter a Title" Width="370px" runat="server" />
<br />
<asp:TextBox ID="txtDescription" placeholder="Enter a Description" Width="370px"
runat="server" />
<br />
<asp:TextBox ID="txtImageLink" placeholder="Image Url" Width="370px" runat="server" />
<br />
<br />
<asp:Button Text="Submit" OnClick="Submit" runat="server" />
<div>
<hr />
<asp:FormView ID="DlAdverties" runat="server" Width="100%">
<ItemTemplate>
<div class="box box box-solid direct-chat direct-chat" style="margin-bottom: 8px">
<div class="box-header " style="background-color: transparent; margin-bottom: 1px;
margin-top: 1px">
<div class="" style="margin-top: 2px; font-variant-caps: titling-caps">
<div class="">
</div>
<div class=" " style="">
<h3 class="box-title">
<asp:Label ID="Label5" runat="server" Text="" CssClass=" glyphicon glyphicon-map-marker"></asp:Label>
Sponsored <span>
</div>
</div>
</div>
<!-- /.box-header -->
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# Eval("URL") %>' CssClass=" ">
<%-- <asp:Image ID="Image1" ImageUrl='<%#Eval("Image") %>' runat="server" Width="30%" />--%>
<iframe scrolling="no" src='<%# Eval("URL")%>'></iframe>
<div class=" well-sm" style="">
<asp:Label ID="Label2" runat="server" Text='<%#Eval("Title") %>' Font-Bold="True "
Font-Size="" />
<div class="clearfix" style="">
</div>
<asp:Label ID="Label3" runat="server" Text='<%#Eval("Website") %>' Font-Bold="True "
Font-Size="Smaller" />
<div class="clearfix" style="">
</div>
<asp:Label ID="Label4" runat="server" Text='<%#Eval("Description") %>' Font-Bold="True "
Font-Size="" ForeColor="#999999" />
<br />
</div>
</asp:HyperLink>
<div class="panel-footer">
<div class="row">
<div class="col-sm-12 text-right" style="">
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("URL") %>' CssClass=" btn btn-default ">
<asp:Label ID="Label1" runat="server" Text='<%# Eval("Category") %>' Font-Bold="True"></asp:Label>
</asp:HyperLink>
</div>
</div>
</div>
</div>
</ItemTemplate>
</asp:FormView>
</div>
</div>
C#
private void GetData()
{
SqlConnection con = new SqlConnection(constring);
SqlCommand cmd = new SqlCommand("SELECT * FROM WebLink", con);
DataTable dt = new DataTable();
SqlDataAdapter sda = new SqlDataAdapter(cmd);
sda.Fill(dt);
if (dt.Rows.Count > 0)
{
DlAdverties.DataSource = dt;
DlAdverties.DataBind();
}
}
protected void Submit(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(constring);
SqlCommand cmd = new SqlCommand("Insert into WebLink values(@Url,@Image,@Title,@Website,@Description,@Category)", con);
cmd.Parameters.AddWithValue("@Url", txtUrl.Text.Trim());
cmd.Parameters.AddWithValue("@Image", txtImageLink.Text.Trim());
cmd.Parameters.AddWithValue("@Title", txttitle.Text.Trim());
cmd.Parameters.AddWithValue("@Website", txtUrl.Text.Trim());
cmd.Parameters.AddWithValue("@Description", txtDescription.Text.Trim());
cmd.Parameters.AddWithValue("@Category", 1);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
GetData();
}
Vb.Net
Private Sub GetData()
Dim con As New SqlConnection(constring)
Dim cmd As New SqlCommand("SELECT * FROM WebLink", con)
Dim dt As New DataTable()
Dim sda As New SqlDataAdapter(cmd)
sda.Fill(dt)
If dt.Rows.Count > 0 Then
DlAdverties.DataSource = dt
DlAdverties.DataBind()
End If
End Sub
Protected Sub Submit(sender As Object, e As EventArgs)
Dim con As New SqlConnection(constring)
Dim cmd As New SqlCommand("Insert into WebLink values(@Url,@Image,@Title,@Website,@Description,@Category)", con)
cmd.Parameters.AddWithValue("@Url", txtUrl.Text.Trim())
cmd.Parameters.AddWithValue("@Image", txtImageLink.Text.Trim())
cmd.Parameters.AddWithValue("@Title", txttitle.Text.Trim())
cmd.Parameters.AddWithValue("@Website", txtUrl.Text.Trim())
cmd.Parameters.AddWithValue("@Description", txtDescription.Text.Trim())
cmd.Parameters.AddWithValue("@Category", 1)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
GetData()
End Sub