.net - Methods To Save Data From JavaScript?
Mar 27, 2011i work asp.net use web methods to save data from JavaScript when i press save the all page go the top how i can save state position after post back
View 4 Repliesi work asp.net use web methods to save data from JavaScript when i press save the all page go the top how i can save state position after post back
View 4 Repliesi want to crete some runtime control in asp.net hence i create one html file & for that i use JAVASCript for repeat that contols.i want to save the data enter into that control.but how it post to .aspx file & how the data save into database
View 1 RepliesI'm doing a project in asp.net with a web services. My web services and my asp.net project is separate and my asp.net projet have a reference of my web services. i'm using visual studio 2008 framework 3.5 and my service web is in vb.net. i want to call the web methods of my web services in javascript my script manager is declared
<asp:ScriptManager runat="server" ID="scriptManager" EnablePageMethods="true" >
<Services>
<asp:ServiceReference path="http://localhost:2931/ServiceCompas.asmx"/>
</Services>
</asp:ScriptManager>
the javascript fuctions
<script type="text/javascript">
function test() {
alert('test');
Service1.Liste_Carte(Onsucced);
}
function Onsucced(resultat) {
alert('je suis passée');
}
</script>
service1 is the class of my Webservice and i call the function test with my button <input name="btnRecherche" class="btnRechercher" type="button" value="Rechercher un emplacement" onclick="test()" /> the problem is : JavaScript say Service1 is not defined but why .... What's the problem ? I've checked many forums and videos every body did it
sorry for the french variable
i have created a simple WCF webserivce and it is running at http://localhost:2699/WCFServiceClient/myService.svc
with method
[Code]....
i have tested it from a wcftestclient it is working fine.
but when i try to call this method from jquery, it doesn't response.
my jquery code
$.ajax({ type: "POST", url: "http://localhost:2699/WCFServiceClient/myService.svc/GetData", data: { 'value': 5 }, contentType: "application/json; charset=utf-8", dataType: "text/xml; charset=utf-8",
success: function (msg) { alert$(msg.d); }, error: function (e) { alert("Unavailable"); } }); }
I recently discovered the client-side methods of some of the controls in the Microsoft ajax control toolkit. For instance, with the TabContainer, I can do something like this:
$find('tabsEditJob').get_tabs()[1].set_enabled(true);
without having to resort to server side code. Is there a way to do this in your own custom user controls without too much work?UPDATE: I was going to implement show and hide methods: although setting display to none would probably work just fine, they would prefer an explicit method. I know that the ajax control toolkit controls have a set_visible method. Do user controls get this too?
how to access the Page methods through javascript.I kept a breakpoint in PageMethod and it never got a hit.
Am i doing anything wrong here?..
<head>
<title>GlobeLocator Gold Map</title>
<script runat="server">
[System.Web.Services.WebMethod]
[Code]...
yes client side must be java script but my qustion is not that.i am asking that can i use c# language to implement "actions" fired on "click side events" such as mouse over the reason for this question is that i remember some syntax of registering functions for particular events of formview, which are call when the event occurs (yes there ispostback involved" is something like the above possible for client side events using c# or even vb.net
protected void Page_Load(object sender, EventArgs e)
{
Label3.Text = "this is label three";
Label3.Attributes.Add("OnMouseOver", "testmouseover()");
}
protected void testmouseover()
{
Label4.Text = "this is label 4 mouse is working!!";
}
At me is user control. I cannot change its property from JavaScript in any way(SectionName) . I can not understand in what a problem?
ratingElement = document.getElementById('ctl00_MainContent_rating_rating_RatingExtender_ClientState');
function handleStateChange() {
if (xmlHttp.readyState == 4) {
[code]...
As a starting point for creating custom controls, I would like to make a control that simply displays a number. If we imagine the .ascx file contains nothing except for a literal control, and the code behind sets that value to 1.
I then want to be able to do myControl.increment();
This will run some javascript that increases the value of the literal control.
I could inject a javascript into the page, such as pseudocode:
page_load
{
scriptything.register("function increment(x) { $('#myLiteral').increment(); });
}
or something, but that wouldn't be myControl.increment, that would just be increment(). More than one control on the page would screw it up.
I have an extension method as follows:
public static class PageExtensions
{
public static int GetUserId(this Page targetPage)
{
var user = Membership.GetUser(targetPage.User.Identity.Name);
return (int)user.ProviderUserKey;
}
}
Now in a page I need to use this method in a static WebMethod, so I have added another 'extension method' to PageExtensions:
public static int GetUserId()
{
return (int)Membership.GetUser(HttpContext.Current.User.Identity.Name).ProviderUserKey;
}
and I call it as follows in my WebMethod: PageExtensions.GetUserId()
public class CacheHelper { /// <summary> /// Removes object with the specified key. /// </summary> /// <param name="key">The key.</param> [code]....
I have this methods for caching..I need to change this methods to use in aDictionary<string,object>
How do I need to change this code Because I am new to asp.net I am still learning..
I am using javascript to open save dialog box
the java script is
function openDialog(path)
{
document.execCommand("SaveAs",true,path);
}
In my project, i am creating linkButtons dynamically and attaching this function with linkButton's OnClient Click event at run time.
LinkButton linkButton = new LinkButton();
linkButton.OnClientClick = "openDialog("+file.ToString()+")";
where "file" contains the path of the file which has to be saved.
But i am getting a javascript error as
"Expected ")" "
I have N number of dynamically created linkButtons and i am associating each linkButton with different file.
How To Save Video files into folder and save path only into database in asp.net using c#.
View 1 RepliesI am beginner in web applications development. I started one little project and host it on source forge "https://homoco.svn.sourceforge.net/svnroot/homoco". And I started implementing authentication in this application to learn how it works. From my experience people never use out of the box things so I want to implement this stuff alone (like in real world projects). So some questions:
1) Is there any reason to use membership out of the box? To use database table schema, stored procedures etc. that tool generate for developer. I think that this lower control over code and I decided to implement it my self. I don't know if I am right.
2) Is my approach in this demo project good or bad (if someone have time I like to do just a little code review)? I created database based on business rules. Not using database schema that membership provider require. Extend "MembershipProvider" class to satisfy my needs. Implement queries to database myself.
3) Now, this question is a little wired but I have to ask it. If we make custom Membership Provider and do sql queries alone, implement all MembershipProvider class methods ourselves, and in application use Membership.blabla() why is this approach different from not extending MembershipProvider class and putting all this methods in some unique class and call its methods then? I hope that someone understand what I ask here.
I am sorry for three questions, but I really trying to find the best way to implement this feature in my demo project like it is a real world application.
I want to save file in particular folder .
how can i do this ?
I have a gridview with empty cells. Whenever a cell is clicked I replace the contents of the cell (innerHTML property) with a string, using javascript.
I would like to save this changes on a 2d array when the index of my combobox is changed. However when I traverse the gridview during my selectedindexchanged event, none of the changes I did to the cells are visible (all the cells are empty). I guess the changes are not persistent.
I am using the ajax control toolkit tabcontainer with 5 tab panels inside of it. Each tab contains areas where one must input information. The page also contains add, edit, and delete buttons with gridviews above them. What I am trying to do is to make the user save or cancel changes when they change the activetab. I am using a javascript confirm box but I need to try to retrieve the value of what is pressed from the javascript box to decide whether to discard the changes or stay on the page and make the user finish the input. Is there any way to save the value from the javascript box into a variable so or must i try something else?
PS I wasnt sure whether to post this in the javascript section or the asp.net section since im using asp.net with c#.This is kinda what im using but would like to turn it into a confirm box and pull the true or false value.
protected void TabContainerContent_ActiveTabChanged(object sender, EventArgs e)
{
if (TabContainerContent.ActiveTabIndex != 0)
[code]....
I need to save a value to a session variable from a javascript function, and then be able to call this value back from the Session into another javascript function during post back.
How do you do this?
function postForm()
{
$.ajax({ [code]....
the dialog box is opening after running this code which is asking to save file. Why does this box comes afterall?
I have a custom ASP.NET solution deployed to the ISV directory of an MS Dynamics CRM 4.0 application. We have created a custom entity, whose data entry requires more dynamism than is possible through the form builder within CRM. To accomplish this, we have created an ASP.NET form surfaced through an IFRAME on the entity's main form.Here is how the saving functionality is currently laid out:
There is an ASP.NET button control on the page that saves the entity when clicked. This button is hidden by CSS.The button click event is triggered from the CRM OnSave javascript event.The event fires and the entity is saved.Here are the issues: When the app pool is recycled, the first save (or few) may: not save be delayed (ie. the interface doesn't show an update, until the page has been refreshed after a few sec)Save and Close/New may not save For issue 1.1 and 2, what seems to be happening is that while the save event is fired for the custom ASP.NET page, the browser has moved on/refreshed the page, invalidating the request to the server. This results in the save not actually completing.
Right now, this is mitigated with a kludge javascript delay loop for a few seconds after calling the button save event, inside the entity OnSave event.Is there any way to have the OnSave event wait for a callback from the IFRAME?
I have an ASPxGridView shown to the user with an edit command button. When the user clicks the edit command button the selected row will change into the edit form.In the edit form I have a control which when clicked will do a custom callback through javascript, the custom callback handler will then change a value on the selected row and call UpdateEdit() to save the changed value and return to the regular grid view layout.
However the new value is never saved to the underlying datasource, in fact if I debug the DataSourceControl's ExecuteUpdate method I see the updated value in the oldValues collection and the values collection has the original value.The javascript that is called from the control in the editform:
javascript:grid.PerformCallback("CloseOrder");
The custom callback handler which runs on the server:
protected void gdOrders_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) {
if (e.Parameters == "CloseOrder") {
var row = gdOrders.GetDataRow(gdOrders.EditingRowVisibleIndex);[code]...
I want to do something similar to what priceline does. It saves the recent searches in a dropdown menu. When you pick one from the recent search. The form will be populated accordingly. (See screen shot [URL] This is what I am thinking. (1) Save the searches into an array in a cookie (2), when a recent search item is chosen, retrive the corresponding array element from the cookie and then populate the form. What do you think is the best way to implement this? I especially want to know how to save the form entries into the cookie and how to populate the form.
View 1 RepliesI have create a web page having dynamically created text boxes if i select value in dropdown list,text boxes auto generates .but i want to save all text box values in SQL server database after clicking on submit button using ajax/JSON request
View 1 RepliesIs it possible to edit images using a javascript library and then send the edited image to the server for saving.
Edits will be in real time, means the user can see the edit result in the same time he is editing without the need to refresh the page.
I want a javascript library to do some edits on an image on a webpage 'such as crop, resize, rotate,...' and send send the edited result to the server.
1)usign execute scalar i will get 1st col and 1st row value.
2)using dataset i will get whole table.. if my stored proc has 2 queries then i will get 2 tables within same dataset.. i can reference therese using ds.tables(0).rows(value).
3)suppose i use a datareader then i will get multiple-rows. i want to know how to get these each separate rows coloumn values into variables. below is the reader aspx.vb
reader = cmd.ExecuteReader();
while (reader.Read()) {
4)what is it mean by data reader is forward only method of getting data.
5)why do we do readeritem.tostring()
6) can you tell me the basic how is this reader,ds,scalar works.i mean i know to use but donot know basics esspecially the dataadpapter.why do we fill it when using dataset.