|
Try this code below
var pgUrl='<%= this.Page.ResolveUrl("~/assets/WebServices/Admin/UsrRoleService.asmx") %>';
|
|
|
|
|
This will not work. The OP is trying to call ASP.NET code from an actual .JS file... that's not going to work.
|
|
|
|
|
By "script file", I assume you mean JavaScript file. You can't call server-side functions from a JavaScript file. You will have to find a way to pass the URL to the JavaScript. One way would be to pass the URL in via the constructor (you would presumably call the JavaScript constructor from an ASPX page in a script block).
Though, I have found that I don't typically need to pass the URL of web services to the JavaScript if I am calling one of the methods using AJAX. Instead, I can add a service reference to the page's script manager (or in the case of a user control, the script manager proxy), then I can call the web service by name (e.g., ProjectName.UsrRoleService.SomeMethod(someParameter, function (resultData) { alert(resultData); }); ).
|
|
|
|
|
Hello All,
I have a datagrid, which has the paging and sorting option set up.
After sorting, the first page looks correct. Then when I click on the second page, I lose the sort and it does not show consistent results. How to maintain the sort order thru out the grid?
I have this set up for paging, nothing new,
public void Datagrid_page(object sender, DataGridPageChangedEventArgs e)
{
dgOBHires.CurrentPageIndex = e.NewPageIndex;
dgOBHires.DataBind();
}
|
|
|
|
|
Before binding the data, get the data, sort it and then bind the data. Can use view state to remember the sort expression.
Naina
|
|
|
|
|
hi all
I am using a third party gateway. The third party gateway does not support query-string , so i will need to post the form to pass the values to the given URL and another thing is that they don't expose the web-services so we need to use their page and that means we need to host it in an iframe in asp.net
so what i did is that i have hidden fields that will be used as parameters as depicted below
<input type="hidden" name="p1" value='4635' />
<input type="hidden" name="p2" value='Reference_test' />
<input type="hidden" name="p3" value='Purchase credits' />
<input type="hidden" name="p4" value='500' />
<input type="hidden" name="m_1" value='142' />
<input type="hidden" name="m_2" value='720' />
and i will have a button to demonstrate what i want and i have an iframe as depicted below
<asp:Button ID="Button1" runat="server" Text="Proceed" PostBackUrl="https://www.vcs.co.za/vvonline/ccform.asp" />
<iframe id="iframe1" src=""
style="width: 744px; height: 333px; margin-top: 16px; margin-bottom: 0px;">
Your browser does not support inline frames or is currently configured not to display inline frames.
</iframe>
now on form load i have this
<body onload="Loadiframe()"
and the Javascript looks like this
<script type="text/javascript">
function Loadiframe() {
document.getElementById("iframe1").src = "https://www.vcs.co.za/vvonline/ccform.asp"
return false;
}
</script>
now the purpose of this , is to load the iframe after the page load event of the asp.net gets fired.
Now my problem here is that when the iframe loads , it does not pass the parameters to the url that is being set in the iframe.
I have attached the example, project. (2kb)
When you run the project you will notice when the iframe loads there is an Error
"NO VCS ID"
now this means that the parameters were not passed when the Iframe loads , i can understand because it seems like iframe does not do a full form post. so to demonstrate what i want, click the proceed button and you will notice it will give you a page with no errors and it will be a page where credit card details are required , i want to iframe to load that the first time.
Example Project[^]
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hi,
I tried many ways to redirect Unauthorized Page on "401.2 - Access Denied".
but its not working.
plz help on this.
Regards,
Beula.
|
|
|
|
|
How about you share the many ways you have tried so we are not telling you the same thing or can point out why it didn't work
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
<customErrors defaultRedirect="ErrorPage.asp*x" mode="On">
<error statusCode="401" redirect="AccessDenied.aspx" />
</customErrors>
protected void Application_EndRequest(Object sender,
EventArgs e)
{
HttpContext context = HttpContext.Current;
if (context.Response.Status.Substring(0, 3).Equals("401"))
{
Response.Redirect("UnauthorisedPage.aspx");
}
}
if (!Request.IsAuthenticated)
{
Response.Redirect("UnauthorisedPage.aspx");
}
IIS > Virtual Directory properties > Custom Errors page > 401;2 > Properties
|
|
|
|
|
I have a simple textbox with an initial text, when I type some other text in the textbox it and click my submit button, I see that the textbox.Text value stays the old initial value and the information which I typed has lost. How can I fix it?
|
|
|
|
|
It sounds like the text is being re-initialised each postback. Try the following (in VB):
If not Page.IsPostback
// Initialise textbox
End If
|
|
|
|
|
Have your verified EnableViewState is on for this control? Is the control being re-initialized during the postback?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
what are the configuratiions in the asp.net validation controls? and please give the code to the configurations?
|
|
|
|
|
Your question makes no sense. Please try to restate clearly what you a trying to do, what you have tried and what issues you have.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
There is configurations. You mean properties?
Important(common) properties of validators are,
ControlToValidate , Display , ErrorMessage , EnableClientScript , IsValid , Text
Additional properties are,
CompareValidator - ControlToCompare, Operator, Type, ValueToCompare
CustomValidator - ClientValidationFunction, OnServerValidate
RangeValidator - MaximumValue, MinimumValue, Type
RegularExpressionValidator - ValidationExpression
RequiredFieldValidator -
ValidationSummary - DisplayMode, HeaderText, ShowMessageBox, ShowSummary
Read this
ASP.NET Validation Server Controls[^]
|
|
|
|
|
I'm using msaccess(2007) database and I get the error message above while tryig to execute the following code:
OleDbCommand cmd = new OleDbCommand();
cmd.CommandText = "INSERT INTO tblCategory(CategoryName, OrderNum) " +
"VALUES(@CategoryName, @OrderNum) " +
"SELECT @@IDENTITY AS ID";
cmd.Parameters.Add(new OleDbParameter("@CategoryName", Category.CategoryName));
cmd.Parameters.Add(new OleDbParameter("@OrderNum", Category.Order));
cmd.Connection = DataAccess.CreateConnection("Malasot", false);
DataTable dt = new DataTable();
OleDbDataAdapter adapter = new OleDbDataAdapter(cmd);
if(cmd.Connection.State != ConnectionState.Open)
cmd.Connection.Open();
adapter.Fill(dt);
note: I have tryed putting semicolon between the 2 statements and it doesn't solve the problem.
modified on Monday, June 20, 2011 2:38 PM
|
|
|
|
|
as your error stating, just place semi colon after the insert statement.
cmd.CommandText = "INSERT INTO tblCategory(CategoryName, OrderNum) " +
"VALUES(@CategoryName, @OrderNum); " +
"SELECT @@IDENTITY AS ID";
Parwej Ahamad
ahamad.parwej@gmail.com
|
|
|
|
|
I've just tryed it, it didn't help
|
|
|
|
|
How about adding a semicolon after the second SQL statement:
cmd.CommandText =
"INSERT INTO tblCategory(CategoryName, OrderNum) " +
"VALUES(@CategoryName, @OrderNum); " +
"SELECT @@IDENTITY AS ID;";
|
|
|
|
|
Error is same OR giving different one? Can you try once to execute two separate statement on by one because I have double that Access generating instantly Identity value.
Thanks,
Parwej
Parwej Ahamad
ahamad.parwej@gmail.com
|
|
|
|
|
I've tryed adding semicolon and the error message I get is: "Characters found after end of SQL statement."
I guess it will work well if I execute 2 seperated commands, but my goal is to execute all in one command, if it's possible.
|
|
|
|
|
Hi Benames,
I haven't try from side, but I had searched on Google and they clearly mentioned that we can not execute multiple statement in single query against Ms Access DB. So may be cause of the error. So if possible execute two separated statement to achieve your goal.
Thanks,
Parwej
Parwej Ahamad
ahamad.parwej@gmail.com
|
|
|
|
|
Ok, probably you are right.
It goes well when I run it in 2 different commands.
|
|
|
|
|
guys;
i want to show an UpdateProgress when triggering an updatepanel to be updated. like this
<asp:button id="button1" runat="server" text="button1" />
<asp:upddatepanel id="upddatepanel1" runat="server">
<triggers>
<asp:asyncpostbacktrigger ControlID="button1" EventName="Click" />
</triggers>
</asp:upddatepanel>
<asp:UpdateProgress ID="ModalUpdateProgress1" DisplayAfter="0"
runat="server" AssociatedUpdatePanelID="upddatepanel1">
<ProgressTemplate>
Loading ...
</ProgressTemplate>
</asp:UpdateProgress>
what do you think?
Help people,so poeple can help you.
|
|
|
|
|
You don't want to use UpdateProgress control?
Parwej Ahamad
ahamad.parwej@gmail.com
|
|
|
|