.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

SqlDataSource - Update Parameter with javascript

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :ASP.Net
Hello, It's possible change the DefaultValue of Parameter with javascript?   Tks

View Complete Post

More Related Resource Links

Run a javascript function after UpdatePanel.Update()


I thought that adding the javascript within the ContentTemplate would cause it to run every time the UpdatePanel was updated.  For example, I would assume that for the following:

<atlas:UpdatePanel ID="UpdatePanel1" runat="server" Mode="Conditional" >
        Hello from inside the update panel!!!!
        <asp:Button ID="foo" runat="server" OnClick="foo_Click" Text="Click me to postback!" />
        <script type="text/javascript">alert('Javascript, baby!');</script>

 would cause the function alert() to run every time the UpdatePanel returns from the button click.  This is not the case, however.

How do I do this?  My update panel contains a scrolling Div and I

Gridview Update outside of SqlDatasource


Is it possible to use a SQLDataSource to populate a gridview but not use the SQLDataSource for Updating?

I wanted to add the update code in the Gridview_RowUpdating event since it is a complex update I need to do.

I get this message when i click the update button

Updating is not supported by data source 'SqlDataSource1' unless UpdateCommand is specified.

Update SharePoint List item using UpdateListItem web service with javascript

I'm using the Custom_AddListMenuItems function in a CEWP to add a menu item to each list item to Archive that item. This is achieved by updating a choice field in the item to 'Archived'. I'm trying to do this using the web service UpdateListItem web service to update the item using Javascript, but I can not find the correct code that updates the list item. I'm using this code:     var ctx=currentCtx;     var ciid=currentItemID;     var xmlHttp=null;     if (confirm("Are you sure you want to Archive this item?"))     {         var soapRequest = '<?xml version="1.0" encoding="utf-8"?>'+             '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'+             '    <soap:Body>'+             '        <UpdateListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">'+         

Javascript to update value in Textbox

Hi I have a javascript file, which creates a calendar picker. This file is used through out the application and is a piece of code that I have to use because my .Net application is part of another application which uses this piece of JavaScript code.Anyhow, with the calendar picker I can save the date into a textbox, but the problem that I have is the format. Unfortunately, I cannot change the calendar picker code because this will affect other parts of the application. Therefore, what I am looking to do is to reformat the date on the textbox control. This I can do but only when I use the javascript event onfocus.Now, my question is this, is there away in javascript or with jquery that when a value enters into a textbox that this value is then reformatted to the format I want without postback or clicking on the textbox?Thanks

facebook notifications update with javascript

Dear all, how can i make notification counter like facebook notifications in the top left of the page , the question is how to make this counter and update a value using javascript or asp.neti want to make something like that , that is updated every 5 min. with the new counter. if anyone can help me with some code tips , it will be greatfulthanks and regards, Mina Jeffrey

Can I update Project Field value via some javascript?

Hi there, I've a webpart that's designed to update some project field value, this webpart is  located on a Project Details Pages. On this project details page, there is another MS Build-in webpart call Project Field webpart. Now when I clicked the Save ribbon button, the project field webpart will raise some client calls, at the same time my custom webpart will raise a post-back(update value via PSI) call which will kill the client calls..So is it possible for me update the project filed value via some javascript? so I'll no longer raise a postback. Or is it possible for me to capture the client calls event for MS webpart, then I can fired my own PSI code? Thank you,   Regards, Joe

SqlDataSource, FormView, and Update with stored procedure in code behind

Hello, Using a FormView with a SqlDataSource, I'm attempting to Update data by calling a stored proc in code behind. I was having trouble getting parameters using Update Parameters in the SqlDataSource, but found a working solution by coding the parameters. The problem now is I'm getting an "Updating is not supported by data source 'XYZ' unless UpdateCommand is specified'. I saw some previous posts on the forums, but didn't find them very enlightening. 

Javascript price update ...hidden field ... asap

Hello Experts http://store.apple.com/us/configure/MC374LL/A?mco=MTc0Njg1ODA Like in this link i created a javascript function  === id , lenght , width , dept , capacity ,price ..<script type="text/javascript">function getproductdetail (id,len,wid,dep,cap,thick,prc)     {          document.getElementById('row1')=prc   }          </script>the same function is called at a new place where i pass only price .. i have to check if there is a price is present in 'row1' i have to add new prc to present one .. =================== thing is where i will retain the old value present .. How to check whether value is prsent in row1 or not ..... if i will choose hidden field where to use and how to check value for that ... Thanks

Uploading an image to a SQL DB via a SQLDataSource parameter


Hi all,

I've got a bit of a problem that I can't figure out.  I've got a SQL data source on a create user page that uploads the user data to a SQL database when the person creating the account clicks the "Next" button.  One of the columns in the DB is an "image" data type and I'm using the FileUpload control to do that.  Here is the ds and its info on the actual page:

<asp:SqlDataSource ID="sqldsAddMember" runat="server" ConnectionString="<%$ ConnectionStrings:myCS %>" InsertCommand="INSERT INTO [Member] ([UserName], [MemberImage]) VALUES (@UName, @Photo)">
        <asp:Parameter Name="UName" ConvertEmptyStringToNull="true" />
        <asp:Parameter Name="Photo" DbType="Binary" ConvertEmptyStringToNull="true" />

In the code-behind I have the following (it's something I found elsewhere on the web):

    Protected Sub CreateUserWizardStep1_Deactivate(ByVal sender As Object, ByVal e As System.EventArgs) Handles CreateUserWizardStep1.Deactivate
        sqldsAddMember.InsertParameters("UName").DefaultValue = Session("UserName&

How to update JavaScript in SharePoint Ribbon Elements.xml file?


I created Elements.xml file that added button to Ribbon of Web Part page.
I created <CommandUIHandler tag and put JavaScript into CommandAction.
Everything works.

I inserted changes to JavaScript and built and deployed project in VS2010.
The button function was not changed the previous JavaScript was used. I uninstalled feature and rebuilt and redeployed project. The button functionality was not changed again.

What I have to do that JavaScript changes work in CommandAction?

Thank you in advance for any help.

Boris Nossov

All parameters null in Update of SQLDataSource?


Hi All,

I have a FormView which is bound to an SQLDataSource. When a user clicks on a save button the form, I need to write any changes made to the FormView back to the table.

I have a Stored Procedure on my MSSQL 2005 database that should be executed when the user clicks on the save button.

It appears the Update is firing, but when I trap the DbCommand object in the SQLDataSource's 'Updating' event, all of the parameters that should be passed to the Stored Procedure are coming through as NULLs. Consequently, the Stored Procedure isn't updating anything.

In the click event of the save button I'm explicitly firing the SQLDataSource's Update method:


The parameters in the SQLDataSource <UpdateParameters></UpdateParameters> section appear to be correct.

Can anyone give me an idea on what to investigate to figure out why it appears the Update is only picking up NULLs?

Many thanks in adavnce,


javascript lost in update panel


Hi i am using an update panel inside this i am using a jquery image upload which works fine outside an update panel, but when inside i think the javascript is not instalising. i have tried using RegisterClientScriptBlock without success.

the javascript is belo, because its a document.ready how can i make sure this is not lost in a update panel?

$(document).ready(function() {

    /* example 1 */
    var button = $('#button1'), interval;
    new AjaxUpload(button, {
    //action: '/CustomHandlers/ImageUpload.ashx?id=99',
        action: '/CustomHandlers/ImageUpload.ashx?id=' + $('#ctl00_ContentPlaceHolder1_hdCompId').val(),  
        name: 'myfile',

        onSubmit: function(file, ext) {
            //check for valid files
            if (!(ext && /^(jpg|png|jpeg|gif)$/i.test(ext))) {
                // extension is not allowed

Update Parameter doesn't update if Null


I have a vb.net page that has an optional parameter.   If a user enters data for that field, and clicks save, it saves fine via the stored procedure.  HOWEVER, if the user changes their mind, and wants to erase the data they entered, they go to the text field, and delete the characters, and click save, but no matter what, the stored procedure will not save the fact that they erased the data (it won't set it back to NULL).  If the user enters a space, the stored procedure will save the space, and if they enter different data, it will save the other data.  I can't figure out how to get it back to letting them set it to Null?      I think this is because it's an optional parameter, and the stored proc is used by several forms (Some of those forms do not include this parameter), but this form utilizes that optional paramater. 

Here's my stored procedure...

CREATE PROCEDURE [dbo].[123456]
@hdnMatterID int,
@BillingArrangementID int,
@BillingArrangementDetails varchar(200) = NULL,   -----This is the parameter that can't seem to get set back to null if a user changes their mind and tries to erase the stored data...
@BillingFrequencyID int


UPDATE  t123456
SET BillingArrangementID = @BillingArrang

Update Parameters with SQLDataSource and VB code behind


I have been going around the houses for several days now. I have an sql datasource that uses a stored Proc  to uodate.  I set the updateParameters values from vbcode behind

        Me.SqlAdministration.UpdateParameters("Licence").DefaultValue = Me.TxtLicence.ToString
        Me.SqlAdministration.UpdateParameters("CompanyName").DefaultValue = CType(FormView1.FindControl("CompanyNameTextBox"), TextBox).Text
        Me.SqlAdministration.UpdateParameters("Status").DefaultValue = CType(FormView1.FindControl("status"), DropDownList).SelectedValue.ToString
        Me.SqlAdministration.UpdateParameters("EmailAccounts").DefaultValue = CType(FormView1.FindControl("txtEmailAccounts"), TextBox).Text
        Me.SqlAdministration.UpdateParameters("EmailGeneral").DefaultValue = CType(FormView1.FindControl("txtEmailGeneral"), TextBox).Text
        Me.SqlAdministration.UpdateParameters("TelAccounts").DefaultValue = CType(FormView1.FindControl("txtTelAccounts"), TextBox).Text
        Me.SqlAdministration.UpdateParameters("TelGeneral").DefaultValue = CType(FormView1.FindControl("txtTelGeneral"), TextBox).Text
        Me.SqlAdministration.UpdateParameters("CompanyAddress").DefaultValue = CType(FormView1.Find

problem with user control+update panel+javascript


hai all,


Im having a aspx page which has 5 tabs inside a update panel..also I have a user control

Wen I click each tab im dynamically loading dat user control .

The problem is im using javascript in dat user control..

the user control has a button which displays a panel containing three grid views  n s activated by a java script as given below..

function Elig()



'<%=btnLegend.ClientID %>')).click(function(){


('<%=pBody.ClientID %>')).slideToggle('slow');




Wen i run the aspx page the first tab  successfully loaded with dat user control n a

Item update in the sharepoint list using web service with javascript



I am using below code for web services with javascript


function CreateListItem(Title)



    var soap1 = createEnvelope(Title);


    var ws = new ActiveXObject("Microsoft.XMLHTTP");    

      if(ws == null) 

       return null;





    ws.setRequestHeader("Content-Type", "text/xml; charset=utf-8");            







  function createEnvelope(Title)


     var batch;

var xmldoc;    

var ListName = 'S

How can you use javascript to call a SliderExtender (textbox) to update its value?


I am trying to develop two step size buttons + and -  so that when you click either one, the AJAX SliderExtender will magically move itself by one.

I have tried implementing the following functions:

document.getElementById ("Slider1_BoundControl").value = 5;
document.getElementById ("Slider1").value =5;

here's what happens, I see that the BoundControl textbox works and it gets updated to 5.  However, the slider still does not update to its new position.  When the slider moves, a postback will occur.

The Slider1 is the textbox that  is the targetID to SliderExtender1 .  The boundcontrolID is Slider1_BoundControl (textbox)

Anyone know ? thanks

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend