我希望从我的clubid获得我的网络服务的价值,然后将其传递到下一页,这样我就会有一个充满活力的俱乐部细节。但是,当我尝试这样做时,它会向我显示一些错误。这是我的代码。
ListClubs.xaml.cs
$('document').ready(function(){
'use strict';
var body = $('body');
//add event bound to the click of a element with class btn-default
body.on('click', '.btn-default', function () {
//remove btn-default from this class and add btn-info
$(this).removeClass('btn-default').addClass('btn-info');
//remove btn-info from this class and add btn-default
$('.btn-info').removeClass('btn-info').addClass('btn-default');
});
body.find('#button1').click(function(){
body.find('#item1').add('#item2').fadeOut();
body.find('#item3').fadeIn();
});
body.find('#button2').click(function(){
body.find('#item3').fadeOut();
body.find('#item1').add('#item2').fadeIn();
});
});
ListClubs.xaml
ClubApiClient service = new ClubApiClient();
public ListClubs ()
{
InitializeComponent();
}
protected async override void OnAppearing()
{
base.OnAppearing();
await setClubs(Clublistview);
}
private async Task setClubs(ListView listview)
{
var clublist = await service.getClubList(2);
listview.ItemsSource = clublist.ToList();
}
async void OnListClubsClicked(object sender, EventArgs e)
{
int clubid = int.Parse(lbId.Text); //Error msg: The name 'lbId' does not exist in the context
await Navigation.PushAsync(new DetailedClub());
}
答案 0 :(得分:2)
使用名称“lbId”没有用,因为列表中的每个项目都有一个名为“lbId”的$(document).ready(function() {
$('#search').click(function() {
var id = $('#sun').val();
var request = $.ajax({
url: 'suns_data.php?job=get_sun',
cpage-content false,
data: 'sun=' + id,
dataType: 'json',
contentType: 'application/json; charset=utf-8',
type: 'get'
});
var table_sun = $('#table_sun').dataTable({
"ajax": "suns_data.php?job=get_sun",
"columns": [
{ "data": "col1" },
{ "data": "col2"},
{ "data": "col3" },
{ "data": "col4" },
{ "data": "col5"}
],
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [-1] }
],
"lengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
"oLanguage": {
"oPaginate": {
"sFirst": " ",
"sPrevious": " ",
"sNext": " ",
"sLast": " ",
},
}
});
});
});
。
您可以使用Label
将ID添加到CommandParameter
Button