DataSource Controls :: Update Parameter With Javascript?

Sep 3, 2010

It's possible change the DefaultValue of Parameter with javascript?

View 6 Replies


Similar Messages:

DataSource Controls :: Use An ObjectDataSource Update Method With A Table - Valued Parameter?

Oct 13, 2010

I'm trying to figure out if it's possible to use an ObjectDataSource Update method with a table-valued parameter. Here's my ODS:

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
DataObjectTypeName="TestProject.MyTestDataTable"
SelectMethod="GetTestData" TypeName="TestProject.BLL.TestBLL"
OldValuesParameterFormatString="original_{0}"
UpdateMethod="UpdateTestData">
<SelectParameters>
<asp:Parameter DefaultValue="65" Name="testId" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>

I bind this to a GridView but I'm not looking to edit row by row. Instead my GridView has a bunch of TemplateFields with textboxes. I also have a Button that when pressed, invokes the Update method of the ODS. So then the "UpdateTestData" function in my TestBLL is called. This looks like this:

public void UpdateTestData(MyTestDataTable dt)
{
QueriesTableAdapter qta = new QueriesTableAdapter();
qta.UpdateTestData(dt);
}

At run-time in debug, it seems like the object for the signature above is not populated with the data from my GridView.

View 1 Replies

DataSource Controls :: Variable Connection String Parameter In A DataSource Control

May 20, 2010

I have several web forms which use a GridView linked to a DataSource control which is defined at design time as follows:

<cc1:pgsqldatasource
id="dsStates"
runat="server"
connectionstring="<%&#36; ConnectionStrings:PgSqlConnection %>"
oldvaluesparameterformatstring="Original_{0}"
providername="<%&#36; ConnectionStrings:PgSqlConnection.ProviderName %>" >
</cc1:pgsqldatasource>

As you can see, the connectionstring parameter is defined to a specific connection string name and I need to be able to set such a parameter to a different value, for example, to a session variable content.

View 1 Replies

DataSource Controls :: Access Property Of Object As Session Variable As Declarative Datasource Parameter Value

Oct 27, 2010

I am storing a custom "Organisation" object as a session variable. One of the properties of the Organisation object is "OrganisationID" (integer). I have a DataSource that requires a parameter value to run, and I want to use a SessionParameter to populate this. In a previous version, I stored the OrganisationID directly as a session variable. In that case, I could easily access it like this:

[Code]....

However, how do I now access the OrganisationID property of an "Organisation" type session variable (called "Organisation")? I have tried this, which does not seem to work: <asp:SessionParameter Name="OrganisationID" SessionField="Organisation.OrganisationID" Type="Int32" />

View 2 Replies

DataSource Controls :: Passing Parameter To Datasource In Code Behind?

Mar 25, 2010

I need to pass the control parameter to Sql Datasource in code behind,

<asp:ControlParameter ControlID="DDL_RType" Name="rtype" PropertyName="SelectedValue"

View 3 Replies

SQL Server :: Update Parameter Doesn't Update If Null?

Sep 27, 2010

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...

[Code]....

[Code]....

View 2 Replies

DataSource Controls :: Used Sqldatasource For Performing And Update Query But How To Update The Record On Click

Nov 9, 2010

Here is the sqldatasource config code: <asp:SqlDataSource ID="SqlDataSource1" runat="server"

View 1 Replies

DataSource Controls :: Update The Data Of A Database Through A Gridview Update Button?

Apr 19, 2010

i want to update the data of a database through a gridview update button

how can i attach a dataconvertion like this

[Code]....

View 1 Replies

Forms Data Controls :: Passing Two Parameter In Javascript

Mar 26, 2011

i am passing two parameter in javascript and open popup window.... but geeting mid value "undefined" here is my code:

<asp:TemplateField HeaderText="comments">
<ItemTemplate>
<a href="javascript:replycomments('<%# Eval("projectid")%>'),('<%# Eval("milestoneserial")%>')">Reply comments</a>
</ItemTemplate>
</asp:TemplateField>

and

function replycomments(id,mid)
{
window.open("replymilestone.aspx?id="+id+"&mid="+mid,"mypage","width=400,height=500,scrollbars=0,menu=0","");
}

this is working fine if i am passing single value like:

<asp:TemplateField HeaderText="comments">
<ItemTemplate>
<a href="javascript:replycomments('<%# Eval("projectid")%>')">Reply comments</a>
</ItemTemplate>
</asp:TemplateField>

and

function replycomments(id)
{
window.open("replymilestone.aspx?id="+id,"mypage","width=400,height=500,scrollbars=0,menu=0","");
}

View 1 Replies

Forms Data Controls :: Add Detailsview Old Values As A Sqldatasource Update Parameter?

Jan 9, 2010

I have a details view that is bound to a sqldatasource. The datasource has some extra parameters besides the updated data on the screen, they are;

[Code]....

I am want to take the old values of the details view from the detailsview1_itemupdating event and add them as a parameter to my sqldatasource.

[Code]....

So how can I then add this as a parameter to my sqldatasource?

View 2 Replies

Forms Data Controls :: DetailsView - Change Parameter List For Update

Jan 22, 2010

i'm beginning with a little question. So i have this scenario

[Code]....

So i have a Linq object named TCategory. When the user wants to edit this object he will have 2 fields id and categoryName and when he press update the UpdateCategory function will receive an already made object of TCategory type storing the data user has typed. The problem is that i also want to let the client to change the id of the object so i need to pass to the function the actual Id and the TCategory object. How can i do this?

[Code]....

View 1 Replies

Forms Data Controls :: Dropdownlist In Gridview Not Populating The Update Parameter?

Nov 5, 2010

during edit mode i populate the drop down in question with data based on a value selected in another drop down also in the gridview, all works find, but the paramater is not being updated with the selected value, i think this is because i do not call any Bind in the aspx side.

<asp:TemplateField HeaderText="Build Types">
<ItemTemplate>
<asp:Label ID="lblBuildTypes runat="server" Text='<%# Bind("BuildType") %>'></asp:Label>
</ItemTemplate>

[Code]....

View 2 Replies

Forms Data Controls :: Pass Checkbox Value To A Parameter At The Time Of Update?

Jul 4, 2010

in a grid view i have a checkbox column ,which is making checked based on the char value from the SQL DB.

In SQL DB field type is char(1).

My requirement is , need to pass "Y" if checkbox is true ,and "N" if checkbox is false.How to pass that parameter in an update statement.

How it is possible?I used the parameter like as follows.But it is giving me an error when i click update.Groupid parameter is working perfect.The error is coming from the "HPermission" parameter.

<asp:BoundField DataField="GroupID" HeaderText="GroupID" InsertVisible="False" ReadOnly="True" SortExpression="GroupID" />
<asp:TemplateField HeaderText="Hud" >
<ItemTemplate>
<asp:CheckBox ID="chkStatus1" runat="server" AutoPostBack=false
Checked='<%# Convert.ToBoolean(Eval("HPermission").ToString().Equals("Y")) %>'
/>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
UpdateCommand="exec [dbo].[GridUpdDel] @GroupID,@HPermission,'UPDATEPERMISIION',0,'',''" >
<UpdateParameters>
<asp:Parameter Name="GroupID" />
<asp:Parameter Name="HPermission" />
</UpdateParameters>

View 3 Replies

DataSource Controls :: Cannot Update DataBase By Using UPDATE Query

Jul 6, 2010

[code]....

Im trying to update my DB(DataBase) by using SQL UPDATE query ,but its not updating in the dataBase i receive confirmation(in testLabel) that one row is affected(dataReader = query.ExecuteReader(); return numbers of rows affected)...

I have given a HTML editortext control on a page,which generates HTML (i have to store it in my DB,that page is only for Admin) ,on pressing Update button , im receving in my testLabel that one row is affected(which shows DB is updated succesfully) but when i check my DB its in old state,it is not updating...

Here is my Event handler of Update Button which have to make updates in DB:

[Code]....

[Code]....

View 2 Replies

DataSource Controls :: DataContext Update Doesn't Update?

Jun 21, 2010

What's wrong with the following code?

[Code]....

After the SubmitChanges call, the Text field in data2 wasn't changed. According to the NerdDinner sample, I supposedly can just write to my data object and then call SubmitChanges.

View 5 Replies

C# - Gridview Update Changing Update Parameter?

Oct 20, 2010

I have a Gridview where I can modify the Time portion of a DateTime field. The update method is working well, except for one thing:The field should only allow the time portion, e.g 08:23:09 but on the Database it saves it as a full DateTime, e.g 10/18/2010 08:23:09 AM. The problem is that upon editing, instead of adding the existing Date portion, it adds the current Date portion. So if I am editing the item from the last example into 08:25:09 instead of adding it as 10/18/2010 08:25:09 AM it adds it as 10/20/2010 08:25:09 AM which is obviously undesired behavior.Here's how I am doing the update:

protected void grvOutHour_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
GridView grvOutHour = (GridView)this.grvReport.Rows[grvReport.EditIndex].FindControl("grvOutHour");
TextBox txtBox = (TextBox) grvOutHour.Rows[e.RowIndex].FindControl("txtEditOutHour");

[code]...

View 1 Replies

DataSource Controls :: SQL Parameter Not Being Sent To Procedure

Aug 3, 2010

What am i missing or doing wrong here, when i debug, im seeing the selected value in the code behind, but when the page loads, it says the following:

Procedure or function 'Onsite_Report_Procedures' expects parameter '@rptNum', which was not supplied.
<asp:SqlDataSource

ID="SQLOnSiteReport"
runat="server"
ConnectionString="<%&#36; ConnectionStrings:connectn %>"
SelectCommand="Onsite_Report_Procedures"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:Parameter Name="@rptNum" Type="String" />
</SelectParameters>
</asp:SqlDataSource>

[Code]....

View 2 Replies

DataSource Controls :: How To Get SP Output Parameter From ODS

Aug 4, 2010

I have a stored procedure with output parameter. I encapsulate it with Table Adapter and BLL. Call it using ObjectDataSource in conjuction with formview, just like the one in Data Access Tutorial. How do I get the output parameter in event INSERTED of the ObjectDataSource in code behind (VB)?

My stored procedure looks like this:

[Code]....

My BLL code looks like this:

[Code]....

View 2 Replies

DataSource Controls :: Output Parameter Not Getting Value?

Jul 12, 2010

We have a stored procedure which creates and returns as output the next value in line:

[Code]....

Yes, the dullards who created this system not only failed to use an identity for the primary key of this table, they then proceeded to add 1 to a varchar column to create the new value, thus insuring it can never be anything but numeric.

Sigh. I'm told we cannot address that obvious deficiency now, and we have to leave the column as varchar. Double sigh.

If I execute this sproc from SSMS, the hh_num variable is returned as expected:

[Code]....

However, when I run it through the application, the parameter I set up as output does not get its Value attribute changed:

[Code]....

I've verified that the "@hh_num" maintains its direction and name through the ExecuteNonQuery call, but its Value remains an empty string.

View 1 Replies

DataSource Controls :: Want To Use Parameter In SQL Command?

Jun 5, 2010

I want to use parameter in SQL command, Which the following code is better and why?

string id= getId();
SqlCommand cmd1 = cn1.CreateCommand();
cmd1.CommandText = " INSERT INTO std(idStd) VALUES (idStd=id) ";
cmd1.ExecuteNonQuery();
string idF = getId();
SqlCommand cmd1 = cn1.CreateCommand();
cmd1.CommandText = " INSERT INTO std(idStd) VALUES (idStd=@id) ";
cmd1.Parameters.AddWithValue(@id, idF);
cmd1.ExecuteNonQuery();

View 3 Replies

DataSource Controls :: Declare Parameter In C#?

May 11, 2010

I´m in need to export datagrids to excel. I found a good solution in C#. I´m a newbie at VB.net. I have got it to work but I´m not familar to set the SQL connection and bind data in C#.

I need to declare my query with a calendar parameter but I have no idea how this should be done in this code.

Either, how do I set parameters into the C# code or how can I set a SQLDATASOURCE in the ASPX file and still run all code.

ASPX CODE

[Code]....

And CS

[Code]....

View 3 Replies

DataSource Controls :: Parameter Is Not Valid?

Apr 13, 2010

I'm trying to get image from database into picturebox

pictureBox1.Image = Image.FromStream(new MemoryStream((byte[])ds.Tables[0].Rows[i].ItemArray[0]));

But I am getting error:

parameter is not valid

View 1 Replies

DataSource Controls :: SQLDataAdapter Parameter?

Jan 26, 2010

I have the following sub that I need help with an error on. When run error message is saying that the parameter called by the stored proc was not supplied. Am I missing something? I can't seem to find it.....

[Code]....

View 4 Replies

DataSource Controls :: Beginner With A Parameter ?

Oct 26, 2010


[Code]...

View 3 Replies

DataSource Controls :: Add Parameter To IN Clause In SQL?

Jan 28, 2010

i am developing an application using asp.net and backend server is SQL SERVER 2005.

in my application i have 12 regions. from that 12 regions user will select any of them.

if user select 1,2,3 then i have to pass this string to IN clause

for that i have storedproc like

create procedure sp_updateDistributorContractforAllRegions (
@unitprice float,
@region varchar(50)
)
update employee set UnitPrice=@unitprice where regionid in (@region)
end
GO

here regionid datatype in employee table is INT.

from code behind i am adding the parameter as 1,2,3.when i run the query it gives the error as

Conversion failed when converting the varchar value '1,2,3' to data type int.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved