locked
Retrieve data to Html from asp.net Button. RRS feed

  • Question

  • User1439056262 posted

    Hi,

    I have asp.net button: 

           <asps:LinkButton ID="btn_Edit" runat="server" CssClass= "btn btn-info" CommandArgument=<%#Eval ("be_bill_id") %>

            CommandName="Edit" OnCommand ="btn_Edit_command" />

    Can i use  this "be_bill_id " in html page to collect data from database and need to display data in .html page.

    If this possible, How?

    Thank You.

    Monday, May 20, 2019 5:52 AM

All replies

  • User61956409 posted

    Hi jaimon,

    jaimon

    Can i use  this "be_bill_id " in html page to collect data from database and print in html page.

    Do you want to display the data in .html page? Please clarify more about the scenario/requirement, so that we can understand it better. 

    Besides, if you'd like to achieve that in .aspx page, you can try to use <%= expressions, like below.

    <%=be_bill_id %>

    In code behind:

    public string be_bill_id = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        be_bill_id = "data from db";
    }

    Test Result:

    Update:

    Can i use  this "be_bill_id " in html page to collect data from database and need to display data in .html page.

    If you'd like to retrieve data from database and display it in your .html page, you can make AJAX request to WebMethod/back-end service from JavaScript client side, and then dynamically update/load the html content based on returned data in AJAX success callback function.

    With Regards,

    Fei Han

    Monday, May 20, 2019 6:43 AM