Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8715481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:51:18+00:00 2026-06-13T05:51:18+00:00

namespace KetBanBonPhuong.Controls.Default { public partial class SugFriends : System.Web.UI.UserControl { private string Uid; protected

  • 0
namespace KetBanBonPhuong.Controls.Default
{
     public partial class SugFriends : System.Web.UI.UserControl
    {
        private string Uid;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["UId"] != null)
        {
            string value = Request.Cookies["UId"].Value;
            Uid = UserService.GetId_Cookie(value);
        }
        else
        {
            Uid = Session["Id"].ToString();
        }
        LoadListSuggest();
    }

    private void LoadListSuggest()
    {
        string str = "";
        List<RankByUser> list = new List<RankByUser>();
        list = RankByUserService.GetListRank(Uid);
        foreach (RankByUser rank in list)
        {
            str += "<li><div class=\"sug_acc\">"
                + "<a href=\"/" + rank.Link + ".aspx\"><img src=\"" + rank.Avatar + "\" alt=\"avatar\"/></a>"
                + "<a href=\"/" + rank.Link + ".aspx\" class=\"sug_name\">" + rank.LastName + " " + rank.FirstName + "</a>"
                + "</div>"
                + "<div class=\"rank\">"
                + "<a href=\"#\" title=\"Xem chi tiết\" class=\"num\">rank: " + rank.Rank + "</a>"
                + "<a href=\"#\" class=\"button mycoblue\">Kết bạn</a>"
                + "</div></li>";
        }
            ltrListSug.Text = str;
        }
    }
}`

It’s a user control SugFriends.ascx being add in Default.Master

When I click "a.button" postback event to server?(I want to insert data to database, I used Sql server)

How to do it? Make tag a event onclick ‘like’ LinkButton: Onclick()?

Thanks for your helping! I found solution that problem! I used Ajax onclick for each tag a, event post Ajax.aspx, in here I can code work with database!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:51:20+00:00Added an answer on June 13, 2026 at 5:51 am

    Add an onclick="(javascript:__doPostBack('','');" attribute to the <a> tag to perform a postback via Javascript. Like this:

                + "<a href=\"#\" class=\"button mycoblue\" onclick=\"(javascript:__doPostBack('','');\">Kết bạn</a>"
    

    More details here


    Response to comment:

    Try creating a button on the page
    <asp:Button ID="btnPlaceHolder" Visible="False" runat="server" /> and then do what I said in this solution but instead use __doPostBack('<%=btnPlaceHolder.UniqueID %>', '')

    From there, you can use the method block
    Private Sub btnPlaceHolder_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPlaceHolder.Click to run the code you want on postback.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

namespace WebApplication1.Site { public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load(object sender,
namespace MyApp.MyNamespace { public class MyClass:System.Web.UI.Page { private DataUtility Util = new DataUtility(); private
namespace foo; class a { private $bar; public $baz; protected $alpha } $reflect=new \ReflectionClass('a');
using namespace std; class A { public: A() {} ~A() {} map<int, string*>& getMap()
namespace Dic { public class Key { string name; public Key(string n) { name
API: namespace ClassLibrary1 { public class Class1 { public static string Test(string input) {
namespace MoqSample.Test { [TestFixture] public class GivenCustomerServiceTest { private ICustomerService customerService; private CustomerModel customer;
namespace hi { class hithere { public int numberOne = 12; private int numberTwo
namespace myApplication { public partial class Form1 : Form { public Form1() { InitializeComponent();
Example: namespace MyProgram.Testing { public class Test1 { public void TestMethod() { String actualType

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.