VS 2013 - Function Parameter Predefined Options
Nov 22, 2014
I created a function as follow
vb Code:
Function FindCapital(ByVal CountryCode As Integer, ByVal CountryName As String) As StringEnd Function
And later on when i call the function I want the function to be able to show all the available CountryCode and CountryName values, so I can select the one I want. I'm not sure how I can do that or if it's possible.
ex :
Code:
FindCapital(US
Canada
Mexico
View 5 Replies
Similar Messages:
Dec 4, 2014
I am trying to call a web service function within my own ASP.net (code behind) using AJAX on the page.
Once i push the button to execute the JS/AJAX/codebehind - I got an error.
POST http://************/admin/Admin.aspx/getDBInformation 500 (Internal Server Error)
This is my code below that I am currently using:
Code:
<WebMethod> _
Public Shared Function getDBInformation() As String
loadDBData()
Return JsonConvert.SerializeObject(dbInfo, System.Xml.Formatting.Indented)
End Function
End Class
The code behind looks like this:
Code:
Imports System.DirectoryServices
Imports System.Security.Principal
Imports System.Net
Imports System.Drawing
Imports System.IO
Imports System.Data.SqlClient
Imports System.Web.Services
Imports Newtonsoft.Json
[Code] ......
How can I correct this issue so that I am able to call **loadDBData()** without that 500 error?
View 2 Replies
Oct 20, 2010
You know how the built in functions in VB.NET gives you the option to pass 1 parameter, 2, 3, or 4 all within 1 function, how do they do that? and when the intellesense comes out, there is a "1 of 4" on the top left of the intellesense and you can click to change and see what the other 4 options are.
View 5 Replies
Jan 18, 2011
I have a Default.aspx program that contains a Treeview with a SiteMapDataSource. I also have a web.sitemap loaded up with urls. When I run the deafult app I get the tree layout that matches the numbers of options but no text on any of the options to click.
View 1 Replies
Feb 9, 2010
[Code]....
and I want to call this Button2_Click from my code, what should I write as parameters of this function?
View 3 Replies
Jun 21, 2010
In a method, I want to call a shared function which its name came as a parameter. For example:
private shared function func1(byval func2 as string)
'call func2
end function
View 2 Replies
Aug 25, 2010
I'm trying to bind a function with Eval as parameter, here is my code snippet:
[Code]....
But It does not work, and the error: The best overloaded method match for 'Utils.Format_Gender(string)' has some invalid arguments
View 2 Replies
Jul 9, 2010
Hopefully this one is not too hard to understand but I just want the label values to be inputs into a javascript function. Might be better to explain with code: ASP.NET Label code:
<asp:Label ID="LabelCL" runat="server" Text="A single int filled in by DB"></asp:Label>
Page Source:
<span id="ctl00_cpMainContent_LabelCL">7</span>
What I would like to achieve but am not sure how to do:
<span id="ctl00_cpMainContent_LabelCL"> <script type="text/javascript">functionX(7)</script> </span>
So basically just wrap the output int in the following:
<script type="text/javascript">functionX( VALUE FROM LABEL TEXT)</script>
within the
<span></span>
View 4 Replies
Jun 17, 2010
I tried to pass a string value into a JavaScript function like below: <%= "'" + prop.property_description + "'") %>) But it does not seems to be the best option, is there a better way to do the above without concatenate the string values with "'"?
View 2 Replies
Jan 15, 2011
I'm using ajax to call a webmethod from javascript. The call is successfully made to the webmethod but I'm not able to access the parameters I passed to the webmethod inside of the "OnSucceeded" callback method. I need access to those params because I need to perform more tasks on the client side when the webmethod returns. I'm assuming that the params are returned inside "usercontext", but the value of that param is "null" How can I have access to those params?
Here my sample code:
function OnSucceeded(result, usercontext , methodName)
{
alert( result + ' The value of usercontext is: ' + usercontext);
}
function OnFailed(error, userContext, methodName)
{
alert('Attempt to delete semantic attribute from page failed!');
}
function deleteSemanticAttribute()
{
var username = 'xxxxxx';
var password = 'yyyyyy'
PageMethods.GetMyData(username, password, OnSucceeded,OnFailed);
}
[WebMethod]
public static string GetMyData(string username, string password)
{
return "This is my test application!";
}
View 2 Replies
Apr 7, 2010
Driving me mad on a personal project; I know I've done this before but elsewhere and don't have the code. As far as I can see, I'm setting the parameter, I'm setting its value, the connection is open, yet when I try to fill the dataset I get the error 'Procedure or function expects parameter "@test" which was not supplied'. (This is obviously a simplified test! Same error on this or the real, rather longer code though.)
C#:
SqlCommand l_oCmd;
DataSet l_oPage = new DataSet();
l_oCmd = new SqlCommand("usp_test", g_oConn);
[code]...
View 1 Replies
Mar 18, 2010
i have a function which returns a value from a query string parameter, i use it in more than 10 places in the webapp thus i have to rewrite the code every time, again and again.so to make it short, is there any way i can embed the code somewhere and keep referring to it through out my app?
View 10 Replies
Mar 3, 2011
I am having the following piece of code that is not working:
<a href="#" onclick="Edit(@Interest);">edit</a>
where I have
@{string Interest=""}
View 2 Replies
Mar 23, 2010
Basically, I have a gridview that is opened in a new window from the parent window. It has a bunch of records with a view button to view the details of each record (which stays in the same newly opened window). I have a calendar in the parent window that accepts a Date querystring parameter to set the current date on the calendar at page load. I'm just trying to refresh the calendar in the parent window to match the date of the label in the newly opened window. All the code below is in the newly opened window. The .Net code-behind below refers to when that view button is clicked and everything is populated. At the end, I call the js to refresh the parent window and pass the value of the LabelScheduleDate as the querystring parameter. Now the label comes through as '03/25/2010' in the code-behind, but when I pass it to the js, it comes through as '0.00005970149253731343' in the end querystring. I'm not really sure what is making the value change, and I want to pass it as just text. Do I need to pass it as a string object? I tried but I don't think I was doing it right.
JavaScript Function
function RefreshParent(inputDate) {
window.opener.location = window.opener.location + "?Date=" + inputDate;
}
.NET Code-Behind
Protected Sub RadGridOnlineRequests_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGridOnlineRequests.ItemCommand
If e.CommandName = "ViewOnlineRequest" Then
' populates LabelScheduleDate among other controls values
ScriptManager.RegisterStartupScript( _
Me, Me.GetType(), "clientScript", "RefreshParent(" & LabelScheduleDate.Text & ");", True)
End If
End Sub
View 1 Replies
Jun 25, 2010
I have the following:
<EditItemTemplate>
<asp:Button ID="wrqst_need_ind_btn" runat="server" Text = "Create WR"
onClientClick="javascript:popUp('popup_createWR.aspx')"
CommandArgument='<%# Eval("dvc_nm") + "|" + Eval("data_orgtn_yr") %>'/>
</EditItemTemplate>
I want to pass in as two additional params the Eval("dvc_nm") and Eval("data_orgtn_yr") to the popup function.
UPDATE:
I tried by removing the single quotes from insode the <% %> tags. Which gave me this:
onClientClick='<%# "javascript:popUp(popup_createWR.aspx," + Eval("dvc_nm") + "," + Eval("data_orgtn_yr") + ")" %>'
which complied, but when I clicked the button I did not get a pop up, the page just posted back and reloaded and said errors on page, but no popup...
View 2 Replies
Jul 26, 2010
I have a problem in my spilt function. When I pass the parameter, the data is getting splitted by given second parameter and it will return the result as table format. The resultant data is getting truncated. I have to create the dynamic update statement by using this table. Below I have shown the function and parameter.
View 2 Replies
Jul 28, 2012
getting this error while inserting near ExecuteNonQuery(); Procedure or function 'Transaction' expects parameter '@idcount', which was not supplied.
View 1 Replies
Jun 30, 2010
I am currently trying to import a value from an SQL database and simply add it to another predefined value.
The problem I am having is that upon trying to add the two values together I am receiving a type mismatch error.
neww = 0
values = objRS1("Amount Including VAT")
neww = neww + values
View 5 Replies
May 19, 2010
I'm using a CustomValidator control to validate some controls in a GridView. I have the validation working perfectly on the client and the server, but would ideally like to pass the GridView ID into the client function so I can move it out into a separate
.js file. The signature for my client function is:
function valOrder_ClientValidate(source, args) { // Code here}
And my CustomValidator control looks like:
[Code]....
Is there a way I can pass an additional parameter into this function?
View 4 Replies
Aug 13, 2010
I have a button inside my <ItemTemplate> in GridView and I want to call a javascript function on the OnClientClick of that button passing the DataItem value as a parameter of the javascript function
[code]....
If I will not put a parameter in CreateEditAddess() this works well but I need the parameter.
I know I can put the OnClientClick event value in OnRowDataBound event of the gridview but I don't want to put it in CodeBehind. It seems like the server tag is not parsed correctly.
View 1 Replies
Nov 11, 2010
I have finally got my paging code for a datalist to work correctly. However, the stored procedure I use receives a Parameter called 'name' which is a VarChar 4. I'm having a little trouble implementing the handling of the 'name' parameter in the following code. I receive the error [Procedure or function 'search' expects parameter '@name', which was not supplied.]
Private Sub DataBind()
Dim objConn As New SqlConnection(ConfigurationManager.ConnectionStrings("SQL2005_504887_2onetennisConnectionString").ConnectionString) [code]....
I think it will look something like the following but I'm not sure because this syntax doesn't look like it would work with my above code.
cmdTest.CommandType = Data.CommandType.StoredProcedure
cmdTest.Parameters.Add(New SqlParameter("@TestParam", Data.SqlDbType.VarChar, 10))
cmdTest.Parameters("@TestParam").Value = "Testing"
View 1 Replies
Dec 7, 2010
Is this possible?
using (Entities db = new Entities())
{
LoadDropDownList(ddlFirst, db.MyTable , (bool)(myMember.Id == 0), (int)myMember.RevenueRangeID);
LoadDropDownList(ddlSecond, db.OtherTable , (bool)(myMember.Id == 0), (int)myMember.OtherID);
}
I am stumbling on what the type of the second parameter should be - I am essentially trying to pass in the Entity-Framework 'table' into a generic routine that loads the DropDownList with data from the 'MyTable' table using custom logic/filtering.SInce I do the same thing about 6 times for 6 different dropdownlist/table combos I wanted to use a generic function to accomplish this.
View 2 Replies
Jun 28, 2010
ArrayList list = acontroller.ListForDisplay(articleModule.expireDate);
How can I get the "list" only display 10 items?
I don't want to set the number to display with stored procedure.
I've got another unrelated question, - from performance perspective, is it more efficient to sort data in stored procedure than sort using "icomparable" after I got a list of data into an arraylist? (30,000 record to sort.
View 10 Replies
Feb 22, 2011
Given a GridView control defined like this:
[code]....
The "FilePath" and "AttachmentID" fields are being set correctly in the grid, however, the CheckBox control is never set correctly; it is always unchecked.
My question:
How do I get this CheckBox field set from C# as I'm creating the new row?
P.S. I am not sure if I am creating the row correctly in the first place.
View 2 Replies
Apr 20, 2010
I need to pass javascript function as a parameter value to the ajax actionlink in asp.net mvc app. how can we achieve this?
View 1 Replies