how to do postback Javascript, jquery
<pre><code>&lt;asp:Button ID="btn" OnClientClick="if(confirm_delete()){
/* post back*/
}else{
return false;
};" OnClick="btnDelete_Click" runat="server" Text="delete"/&gt;
</code></pre>

<p>Hi I have this code but I cant do postback for it, im not sure how to?</p>

<p>is it:</p>

<pre><code>&lt;script type="text/javascript"&gt;

        function CallServer() {

               __doPostBack('not sure what goes here','or here');

        }

    &lt;/script&gt;
</code></pre>

<p>Then:</p>

<pre><code>&lt;asp:Button ID="btn" OnClientClick="if(confirm_delete()){
/CallServer()/
}else{
return false;
};" OnClick="btnDelete_Click" runat="server" Text="delete"/&gt;
</code></pre>

<p>My other script:</p>

<pre><code>    &lt;script type="text/javascript"&gt;
    function confirm_delete()
{
  if (confirm("Are you sure you want to delete this comment?")==true)
    return true;
  else
    return false;
}
&lt;/script&gt;
</code></pre>

<p><strong>EDIT:</strong></p>

<p>On the server side i dynamically add a div to my page with content from my database for each content there is a new div will be added, each div is then refrenced with idWallPosting (so i can call my delete function)</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.Odbc;
using System.IO;

public partial class UserProfileWall : System.Web.UI.Page
{

    protected void Page_Load(object sender, EventArgs e)
    {
        //btn.Visible = false;
        string theUserId = Session["UserID"].ToString();
        PopulateWallPosts(theUserId);
    }
    private void PopulateWallPosts(string userId)
    {

        using (OdbcConnection cn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Database=gymwebsite2; User=root; Password=commando;"))
        {
            cn.Open();
            using (OdbcCommand cmd = new OdbcCommand("SELECT idWallPosting, wp.WallPostings, p.PicturePath FROM WallPosting wp LEFT JOIN User u ON u.UserID = wp.UserID LEFT JOIN Pictures p ON p.UserID = u.UserID WHERE wp.UserID=" + userId + " ORDER BY idWallPosting DESC", cn))
            {
                //("SELECT wp.WallPostings, p.PicturePath FROM WallPosting wp LEFT JOIN [User] u ON u.UserID = wp.UserID LEFT JOIN Pictures p ON p.UserID = u.UserID WHERE UserID=" + userId + " ORDER BY idWallPosting DESC", cn))
                using (OdbcDataReader reader = cmd.ExecuteReader())
                {
                    test1.Controls.Clear();

                    while (reader.Read())
                    {

                        System.Web.UI.HtmlControls.HtmlGenericControl div = new System.Web.UI.HtmlControls.HtmlGenericControl("div");
                        div.Attributes["class"] = "test";


                        div.ID = String.Format("{0}", reader.GetString(0));
                        // this line is responsible, problem here and my sqlsntax, im trying to set the SELECT idWallPosting for the div ID
                        Image img = new Image();
                        img.ImageUrl = String.Format("{0}", reader.GetString(2));

                        img.AlternateText = "Test image";

                        div.Controls.Add(img);
                        div.Controls.Add(ParseControl(String.Format("&amp;nbsp&amp;nbsp&amp;nbsp;" + "{0}", reader.GetString(1))));
                        div.Attributes.Add("onclick", "return confirm_delete();");

                        div.Style["clear"] = "both";
                        test1.Controls.Add(div);

                    }
                }
            }
        }
    }

    //protected void btnDelete_Click(object sender, EventArgs e)
    //{

    //    string id = "ctl00_ContentPlaceHolder1_ContentPlaceHolder2_26";
    //    string[] idFragments = id.Split('_');
    //    id = idFragments[idFragments.Length - 1];

    //    //serverside code if confirm was pressed.
    //        using (OdbcConnection cn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Database=gymwebsite2; User=root; Password=commando;"))
    //        {
    //            cn.Open();
    //            using (OdbcCommand cmd = new OdbcCommand("DELETE FROM WallPosting WHERE idWallPosting = " + id + ")", cn))
    //            {
    //                cmd.ExecuteNonQuery();
    //            }
    //        }
    //        //PopulateWallPosts();

    //}

    protected void Button1_Click(object sender, EventArgs e)
    {
        string theUserId = Session["UserID"].ToString();
        using (OdbcConnection cn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Database=gymwebsite2; User=root; Password=commando;"))
        {
            cn.Open();
            using (OdbcCommand cmd = new OdbcCommand("INSERT INTO WallPosting (UserID, Wallpostings) VALUES (" + theUserId + ", '" + TextBox1.Text + "')", cn))
            {
                cmd.ExecuteNonQuery();
            }
        }
        PopulateWallPosts(theUserId);
    }
    protected void btn_Click(object sender, EventArgs e)
    {
        string id = "ctl00_ContentPlaceHolder1_ContentPlaceHolder2_26";
        string[] idFragments = id.Split('_');
        id = idFragments[idFragments.Length - 1];

        //serverside code if confirm was pressed.
        using (OdbcConnection cn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Database=gymwebsite2; User=root; Password=commando;"))
        {
            cn.Open();
            using (OdbcCommand cmd = new OdbcCommand("DELETE FROM WallPosting WHERE idWallPosting = " + id + ")", cn))
            {
                cmd.ExecuteNonQuery();
            }
        }
        //PopulateWallPosts();
    }
}
</code></pre>

<p>On my asp.net html side i have:</p>

<pre><code>    &lt;script type="text/javascript"&gt;
    function confirm_delete()
{
  if (confirm("Are you sure you want to delete this comment?")==true)
    return true;
  else
    return false;
}
&lt;/script&gt;
&lt;p&gt;
&lt;asp:Button ID="btn" OnClientClick="return confirm_delete();" runat="server" 
        CssClass="Btn" Text="delete" onclick="btn_Click"/&gt;
    &lt;asp:TextBox ID="TextBox1" name="TextBox1" runat="server" Rows="3" 
        Height="47px" Width="638px"&gt;&lt;/asp:TextBox&gt;
&lt;/p&gt;
&lt;p&gt;
     &lt;asp:Button ID="Button1" runat="server" Text="Post Message" Width="98px" 
        onclick="Button1_Click" /&gt;
    &lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
    &lt;style type="text/css"&gt;
    img {border-width:0px; width:100px; height:100px;}
&lt;/style&gt;
    &lt;div id="test1" runat="server" /&gt;


    &lt;/div&gt;


&lt;/asp:Content&gt;
</code></pre>

<p>If you notice in my server side code I added this line:</p>

<pre><code>div.Attributes.Add("onclick", "return confirm_delete();")
</code></pre>

<p>This works any time I click on my div the confirm_delete is called.</p>

<p>What I was trying to do with my asp.net button was when the div was clicked I could then call the "onclick btnDelete_click". </p>
