473,854 Members | 1,695 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to set value of a SqlDataSource parameter in HTML code?

K B
Hi,

I have a gridview with a SqlDataSource. One of the parameters I need to
use in the update is the logged on person. The parameter was created
automatically, but I need to override the value with the "new" person
doing the update (e.g., sUser).

How can I do this please?

<asp:Paramete r Name="LastUpdat edBy" Type="String" />

Thanks!
Kit

*** Sent via Developersdex http://www.developersdex.com ***
Mar 29 '06 #1
2 3861

How about:
protected void Page_Load(objec t sender, EventArgs e)
{
SetQueryParamte r();
}
private void SetQueryParamet er()
{
MySqlDataSource .SelectParamete rs["LastUpdate dBy"].DefaultValue = sUser;
}
"K B" wrote:
Hi,

I have a gridview with a SqlDataSource. One of the parameters I need to
use in the update is the logged on person. The parameter was created
automatically, but I need to override the value with the "new" person
doing the update (e.g., sUser).

How can I do this please?

<asp:Paramete r Name="LastUpdat edBy" Type="String" />

Thanks!
Kit

*** Sent via Developersdex http://www.developersdex.com ***

Mar 30 '06 #2
That should work. An alternative would be to put the following in the
Page_Load:

SQLDataSource.U pdateParameters .Add(ParameterN ameWithoutTheAt Symbol, Value)
Where you need to make sure that the parameter is not yet created.
(thanks to 'clickon' who answered the same kind of question to me
yesterday).

--
Kees de Winter
"Dabbler" <Da*****@discus sions.microsoft .com> wrote in message
news:CF******** *************** ***********@mic rosoft.com...

How about:
protected void Page_Load(objec t sender, EventArgs e)
{
SetQueryParamte r();
}
private void SetQueryParamet er()
{
MySqlDataSource .SelectParamete rs["LastUpdate dBy"].DefaultValue = sUser;
}
"K B" wrote:
Hi,

I have a gridview with a SqlDataSource. One of the parameters I need to
use in the update is the logged on person. The parameter was created
automatically, but I need to override the value with the "new" person
doing the update (e.g., sUser).

How can I do this please?

<asp:Paramete r Name="LastUpdat edBy" Type="String" />

Thanks!
Kit

*** Sent via Developersdex http://www.developersdex.com ***

Mar 30 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
5049
by: Mike Kelly | last post by:
I've chosen to implement the "optimistic concurrency" model in my application. To assist in that, I've added a ROWVERSION (TIMESTAMP) column to my main tables. I read the value of the column in my select, remember it, and then use it in the update. It works just fine when I have full control of the whole process. I want to do the same for my GridView/SqlDataSource combinations. I typically select from a view and update the corresponding...
3
11291
by: michelle | last post by:
I am trying to get an output value from a stored procedure using sqlDataSource in asp.net 2.0. But I only get a null value for the output. Can someone please help? The sqlDataSource: <asp:SqlDataSource ID="DataSource1" runat="server" ConnectionString="<%$ ConnectionStrings: ConnectionString1 %>" SelectCommand="UserLkp" SelectCommandType="StoredProcedure"
6
8283
by: Dabbler | last post by:
I have a dropdownlist in a GridView ItemTemplate. I need to bind the ddl to an SqlDataSource, then have a value from a boundfield in the row be passed as the keyfield for select where clause. Im trying to load the ddl with a list of dates from another table keyed on GridView row field that only apply to this row. Any suggestions would be appreciated.
0
3342
by: Ed | last post by:
All of a sudden my previously working code started throwing this error. from the SqlDatasource. I am using C# and Asp.net 2.0. Getting the following error: You have specified that your delete command compares all values on SqlDataSource 'sdsAddEdit', but the dictionary passed in for values is empty. Pass in a valid dictionary for delete or change your mode to OverwriteChanges.
0
1604
by: Managed Code | last post by:
Hello, I have a status and definition table. The status table's current status field relates the ID field of the definition table. I am trying to retrieve the definitions that are associated only with the master_id for the status table's current status. After having some trouble databinding I found a solution using a hidden label to save the value I need for my select parameter. The error I am receiving is 'ddlStatus' has a...
4
7257
by: =?Utf-8?B?QmFidU1hbg==?= | last post by:
Hi, I have a GridView and a SqlDataSource controls on a page. The SqlDataSource object uses stored procedures to do the CRUD operations. The DataSource has three columns one of which - "Modified" of type DateTime - is hidden since it should not be edited by a user. The system handles the update for this column. So, I have hidden (Visible=false) this column on the grid. In order to access the value in this field, I have created a...
3
8020
by: Ken Cox [Microsoft MVP] | last post by:
I've been going around and around on this one. I can't believe that it is "by design" as Microsoft says. Here's the situation: In *declarative* syntax, I'm trying to create a default datetime value for a SqlDataSource parameter. (I know how to insert this parameter in code. I want to use declarative markup.) Here's the declarative markup with ???????? indicating where I'm stumped.
3
2321
by: Roger Jordan | last post by:
Hello, I'm using a SQLDataSource with name SqlDataSource1, the DeleteCommand has a parameter, with isdefined in SqlDataSource.DeleteParameter: DELETE FROM WHERE =@ID The parameter is not bind to any control, cookie or something like this. How do I set a value for this parameter before calling the SQLDataSource1.Delete() method?
4
2920
by: justice750 | last post by:
Hi All, I am using a FormView control. The allows me to update records in the database. However, when a database field is null I can not update the field on the form. It works fine when the field is not a null value. I am not using any code behind (C#) to bind the data or manipulate the data. I have read that when there is a null value in the database that there is no record in the "dataset". Can anyone show me how to bind a value in the...
0
9750
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10672
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10744
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10364
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7077
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5738
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5937
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4550
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4150
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.