I got a li - list, one with an onclick:
<ul class="tabs">
<li><a href="#tab1">Foobar_1</a></li>
<li onclick="doMethod"><a href="#tab2">Foobar_2</a></li>
<li><a href="#tab3">Foobar_3</a></li>
<li><a href="#tab4">Foobar_4</a></li>
</ul>
Now, the method I want to call when clicked on a tab (the li's), updates an UpdatePanel, so a gridview is shown.
I know it must have something to do with AJAX, but I ain't got a clue how to move on now...
so basically: how to call a c# method using AJAX?
The call by reference method of passing arguments to a function copies the address of an argument into the formal parameter. Inside the function, the address is used to access the actual argument used in the call. It means the changes made to the parameter affect the passed argument.
The call by value method of passing arguments to a function copies the actual value of an argument into the formal parameter of the function. In this case, changes made to the parameter inside the function have no effect on the argument. By default, C programming uses call by value to pass arguments.
Just declare the C++ function extern "C" (in your C++ code) and call it (from your C or C++ code). For example: // C++ code: extern "C" void f(int);
The python default implementation is written in C programming and it's called CPython. So it's not very uncommon to use C functions in a python program. In this tutorial, we learned how to easily call C functions in a python program.
<li runat="server" OnClick="DoMyOnClickCall">....</li>
Then
public void DoMyOnClickCall(object sender, EventArgs e)
{
// sender is the li dom element you'll need to cast it though.
}
To expand: (Update)
sender
is an object that represents the <li>...</li>
in HTML. It's called something like HtmlControl
.
You'll need to cast sender
to that type.
var myLI = (HtmlControl)sender;
// do stuff with `myLI`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With