Skip to content
Loading
  
  •   
  •                                       
  •                                   
  • +2
  • Jes Sie
    +2
    Thanks for the response Sachin. I tried the code you suggested but it doesn't work. I even added "ContentPlaceHolder1_DataList1" because I am using a master file, but still, it doesn't work.
     
    1. "text/javascript">    
    2.        $('#ContentPlaceHolder1_DataList1_btnSelect').click(function () {  
    3.            $('#ContentPlaceHolder1_DataList1_hlYearbook').click();  
    4.        });  
    5.   
    6.        //$('#btnSelect').click(function () {  
    7.        //    $('#hlYearbook').click();  
    8.        //});  
    9.      
     
    +2
  • Sachin Singh
    +2
    inspect and check whether the Id is still correct or not, or use
     
    1. "text/javascript">   
    2. $('[id^="btnSelect"]').click(function()  
    3.  {    
    4. $('[id^="hlYearbook"]').click();    
    5. });    
    6.    
    +2
  • Rijwan Ansari
    +2
    You can pass value using commandArgument or DataBinder as shown:
     
    commandArgumanted.
     
    1. "btnSelect" runat="server" Text='<%# Eval("SchoolYear") %>' CssClass="btn btn-primary font"  
    2.                     Width="190px" Height="100px" CommandArgument='<%# Eval(Container.DataItem,"FilePath") %>' OnClick="btnSelect_Click"/>  
    On click function
    1. Button btn = sender as Button;  
    2. var filePath = btn.CommandArgument.ToString();  
     
     Another way is DataBinder on btn click
     
    1. string filePath = DataBinder.Eval(Container.DataItem, "FilePath").ToString();  
     
     https://stackoverflow.com/questions/45975503/how-to-send-data-from-datalist-using-button-to-different-pages-in-asp-net
    +2