How To Write A Parameter For The Function
Feb 9, 2010[Code]....
and I want to call this Button2_Click from my code, what should I write as parameters of this function?
[Code]....
and I want to call this Button2_Click from my code, what should I write as parameters of this function?
I would like to write a function to reuse some functionality that I repeat over and over...
For example:
[code]....
What's changing, in every field, is only the lambda function to get the current field to edit (Name, City, Address, etc...).
What is the best method? Or better: is there ANY method to extract a generic function?
How to change to use like instead of = ?
([Card_no] = @Search)
Moreover, if i want to show all in default, this method force to user to type something first. How to show all in default when using control parameter?
SelectCommand="SELECT [Serial_no], [Transaction_Date], [Card_no], [Company],[IsCredit], [Fee] FROM [CarPark] WHERE ([Card_no] = @Search) or ([Company] = @Search)"
UpdateCommand="UPDATE [CarPark] SET
Card_no=@Card_no,
Company=@Company,
IsCredit=@IsCredit,
Fee=@Fee........
I'm trying to build my first MVC site and also write unit test for the first time. I can't figure how to write unit test for methods that take parameters. How do I write a test method for this controller action?
[Code]....
I have a simple class Employee that I would like to validate using attributes, but I'm not sure how to write the Validate function:
[Code]....
what my Validate function should look like?
I have database code like this
try
{
string strConnectionString = ConfigurationManager.ConnectionStrings["SqlServerCstr"].ConnectionString;
SqlConnection myConnection = new SqlConnection(strConnectionString);
myConnection.Open();
string hesap = Label1.Text;
string musteriadi = DropDownList1.SelectedItem.Value;
string avukat = DropDownList2.SelectedItem.Value;
SqlCommand cmd = new SqlCommand("INSERT INTO AVUKAT VALUES (@MUSTERI, @AVUKAT, @HESAP)", myConnection);
cmd.Parameters.AddWithValue("@HESAP", hesap);.......
It works fine but what I want, in the catch function, is to call the javascript alert function.
I've tried this
Response.Write("<script language=javascript>alert('ERROR');</script>);
But there is an error
How can I show error message in javascript alert function?
to write function in C#
I need to write function for this algorithm.
SSCC
The check digit calculation uses the standard method. Suppose you want to calculate the check digit for ID number 10614141192837465.
Step One: From the right to left, start with odd position, assign the odd/even position to each digit.
Index
1
2
3
4
5
Digit
1
0
6
1
Position
odd
even
odd
even
Step Two: Sum all digits in odd position and multiply the result by 3.
(1+6+4+4+1+2+3+4+5)*3=90
Step Three: Sum all digits in even position.
(0+1+1+1+9+8+7+6)=33
Step Four: Sum the results of step three and four:
90+33=123
Step Five: Divide the result of step four by 10. The check digit is the number which adds the remainder to 10. In our case, divide 123 by 10 we get the remainder 3. The check digit then is the result of
10-3=7.
I'm new to C# and ASP and can't seem to figure out how to write a function to return a CSS Class name.
Here's what I have so far:
In "MyWeb.master" I have a line that reads:
<asp:HyperLink ID="HyperLink1" text="xxxxx"
cssClass='<%# MyCssStyle("ddd") %>'
NavigateUrl="http://www.RDRR.com/Catalog.aspx?TribeID=1"
runat="server" />
And in "MyWeb.master.cs" I have a routine within the partial class that reads:
public string MyCssStyle(string myInput)
{
myInput = "NavigationBarUnselected";
return myInput;
}
This code does not throw an error, but neither does it return a value. What have I missed?
I have a tbale in database tow tables city and Intrest I need to calculate somethign like this
city1*intrest1 + city2*Intrest2 + city3*intreste3
final result I ned to asing in other column
How to develop approval system through email using asp.net?
Process Flow:
1. User submit order form request to manager. - The Order Form will send email to manager and ask for the approval.
2. Manager will do approve on his email.
Is it mandatory to write $(document).ready(function () {... }) every time ?
Can't we do it without this line?
We have two database called First(Application) and Last(Workflow) I am submitting a Personal injury report which contains Date of Accident,time,eventID,eventDate,etc.
After submitted the button, these values in insert one of the database(First). At the same time few above column values in insert on another database(Last). Now i want to write a function to insert these values (selected values from both the tables) into new table in First Database.
Because we are adding new tables for audit purpose. User are saying their report are missing. that y we are inserting new table.
i have a model:
[Code]....
and in my controller, i have:
[Code]....
and this ViewData contains the information of a type of List<SelectListItem>,which can be used to generate a dropdownlist in the view later on. BUT, now i want to write a function in my controller to generate List<SelectListItem> based on different input enum, what like want to do is like this:
[Code]....
however, there are so many errors.
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
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
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>
In a.aspx i have a textbox with ID="Textbox1".In b.aspx, i have a label with ID="Label1"I want when i open b.aspx, Label1.text = Textbox1.Text..but when i write in b.aspx Page_Load function, intellisense don't know Textbox1.
View 5 RepliesI 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 RepliesI'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!";
}
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]...
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
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 RepliesI am having the following piece of code that is not working:
<a href="#" onclick="Edit(@Interest);">edit</a>
where I have
@{string Interest=""}
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
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...