DataSource Controls :: Set Defaultvalue Of Selectparameter With Array?
Feb 6, 2011
I'm working with Linq and I'm using with ObjectDataSource that have SelectParameters tag for inserting default parameters to object.
How can I set <DefaultValue> for an array parameter ?? (i.e : object that have 2 parameters - string and array of int , I can set <DefaultValue> for the string but I don't know how to do it for array)
View 1 Replies
Similar Messages:
Sep 21, 2010
If I ran my sproc from query analyzer, I get the correct results(data is filtered by datetime), i.e:
exec Uds.Dashboard_GetJobs '9/20/2010 11:01:23 PM'
However, if I ran it from the Asp.Net page, (ALL records are showed). Looking at the SQL Profiler I see the following call:
exec sp_executesql N'exec Uds.Dashboard_GetJobs',N'@date nvarchar(21)',@date=N'9/20/2010 11:01:23 PM'
Running both statements above in the query analyzer it WILL return me different results. Why? Someone mentioned that it looks like I don't have correct data type specified for SQLParameter in .Net application. I was asked to create something like:
cmd.Parameters.Add("@Date",SqlDbType.DateTime).Value =
Well, my code in the asp.net is in this form:
<asp:SqlDataSource ID="sourceRealtimeLogging" runat="server"
ConnectionString="<%$ ConnectionStrings:UctConnectionString %>"
SelectCommand="exec Uds.Dashboard_GetJobs">
<SelectParameters>
<asp:ControlParameter ControlID="UpdatedTimeUTC" Name="date" PropertyName="Text" />
</SelectParameters>
</asp:SqlDataSource>
So I guess I am passing a string to SQL, not a datetime type. How do I fix this? Not even sure if this is the cause of my issue but worth a try.
View 3 Replies
Jan 11, 2010
I am really sorry for this, but this is such a bizarre situation I don't know where to turn. I have a stored procedure that takes four parameters (two dates, a positionID, a userID). The SQLDataSource is very generic:
[Code]....
and I set the parameters via this code:
[Code]....
When this executes, no matter what the value of PositionID, it acts as if the PositionID is zero. Now, if I remove PositionID variable and add the number:
[Code]....
All is well. Also, when I look at the parameter in the immediate window, it appears to be correct:
[Code]....
View 5 Replies
May 24, 2010
I am trying to get my Nested ListView to work. I have my parent List View supplying the correct information, but I can't seem to set the SelectParameter Value for my Nested ListView. I am using SQLDataSources for both. I read your comment about adding a Hidden Field. Where Should that field be located. Right now I have it inside my Parent ItemTemplate but nothing is happening. Currently I have both DataSource outside my Parent ListView. I tried moved the nested ds inside with the list view but I still was not able to grab the hidden field values either. Here's what I have:
<asp:ListView
ID="lv"
runat="server"
DataSourceID="sdsParent"
DataKeyNames="CaseNo">
<LayoutTemplate>
<div
class="grid">
<h2>Bankruptcies
by RetailerID <asp:ImageButton
ID="btnSort"
runat="server"
ImageUrl="images/sort_asc.gif"
ImageAlign="AbsMiddle"
CommandName="Sort"/></h2>
<table
id="tblBankruptcy"
cellpadding="0"
cellspacing="0">
<tr
class="head">
<th
class="first"></th>
<th>Retailer
ID</th>
<th>Retailer
Name</th>
<th>Chapter
Number</th>
<th>District</th>
<%
--<th>Date</th>--%></tr>
<tr
id="itemPlaceholder"
runat="server"
/>
</table>
<table
id="pager"
cellpadding="0"
cellspacing="0">
<tr
class="pager">
<asp:DataPager
ID="pager"
runat="server"
PageSize="8">
<Fields>
<asp:TemplatePagerField
OnPagerCommand="PagerCommand">
<PagerTemplate>
<td
class="commands">
<asp:ImageButton
ID="btnFirst"
runat="server"
CommandName="First"
ImageUrl="images/first.gif"
AlternateText="First Page"
ToolTip="First Page"
/>
<asp:ImageButton
ID="btnPrevious"
runat="server"
CommandName="Previous"
ImageUrl="images/prev.gif"
AlternateText="Previous Page"
ToolTip="Previous Page"
/>
<asp:ImageButton
ID="btnNext"
runat="server"
CommandName="Next"
ImageUrl="images/next.gif"
AlternateText="Next Page"
ToolTip="Next Page"
/>
<asp:ImageButton
ID="btnLast"
runat="server"
CommandName="Last"
ImageUrl="images/last.gif"
AlternateText="Last Page"
ToolTip="Last Page"
/>
</td>
<td
class="info">
Page
<b>
<%
# Container.TotalRowCount > 0 ?
Math.Ceiling(((double)(Container.StartRowIndex + Container.MaximumRows)
/ Container.MaximumRows)) : 0 %></b>
of
<b>
<%
#
Math.Ceiling((double)Container.TotalRowCount / Container.MaximumRows)%></b>
(<%
# Container.TotalRowCount %> items)
</td>
</PagerTemplate>
</asp:TemplatePagerField>
</Fields>
</asp:DataPager>
</tr>
</table>
</div>
</LayoutTemplate>
<ItemTemplate>
<%
<%
-- <table id="orders" cellpadding="0" cellspacing="0">--%><tr
id="itemPlaceholder"
runat="server"
/>
-- </table>--%><tr
id="row"
runat="server"
class="group">
<th
class="first">
<img
src="images/plus.png"
alt='Group:
<%# Eval("CaseNo")%>'
onclick="toggleGroup(this, '<%# Eval("RetailerId") %>');"
/>
</th>
<th
colspan="1">
<%
# Eval("RetailerId")%>
</th>
<th>
<%
# Eval("RetailerName")%></th>
<th>
<%
# Eval("BankruptcyTypeID")%>Chaper 11</th>
<th>
<%
# Eval("DistrictID")%>District</th>
</tr>
</ItemTemplate>
<SelectedItemTemplate>
<asp:ListView
ID="lvItems"
runat="server"
DataSourceID="sdsChild">
<LayoutTemplate>
<tr
runat="server"
id="itemPlaceholder"
/>
</LayoutTemplate>
<ItemTemplate>
<tr
class="item">
<th></th>
<th>Action</th>
<th>Comments</th>
<th>Attorney
Information</th>
<th>Date</th>
</tr>
<tr
id="row"
runat="server"
class="item">
<td
class="first"></td>
<td><%#
Eval("ActionID")%></td>
<td><%#
Eval("CaseNo")%></td>
<td><%#
Eval("Comments")%></td>
<td><%#
Eval("AssigneId") %></td>
<td><%#
Eval("Date",
"{0:MM/dd/yyyy}")%></td>
<td><%#
Eval("CaseNo") %></td>
</tr>
</ItemTemplate>
</asp:ListView>
</SelectedItemTemplate>
</asp:ListView>
<asp:SqlDataSource
ID="sdsParent"
runat="server"
ConnectionString="<%$ ConnectionStrings:Legal %>"
SelectCommand="SELECT * FROM [tblBankruptcy ]">
</asp:SqlDataSource>
<asp:SqlDataSource
ID="sdsChild"
runat="server"
ConnectionString="<%$ ConnectionStrings:Legal %>"
SelectCommand="select * from tblbankruptcyaction where CaseNo = @CaseNo">
<SelectParameters>
<asp:ControlParameter
ControlID="hf1"
Name="CaseNo"/>
</SelectParameters>
</asp:SqlDataSource>
View 2 Replies
Mar 1, 2010
I an expanding on the HotGridView control (http://msdn.microsoft.com/en-us/magazine/cc163612.aspx). During testing I noticed the "AutoGenerateCheckBoxColumn" behavior was returning true even if the user did not specify the a value in the markup but I expect it to return False if not value is supplied by the user - can anyone shed some light on why the AutoGenerateCheckBoxColumn is always true if not explicitly set to False in the markup?
[Code]....
View 1 Replies
Jan 7, 2010
How do I set the selectparameter of Objectdatasource in usercontrol from dropdownlist in parent page?I tried the following but when I select a new value in the dropdownlist it does not change the data from the initial page load
Protected Sub ODSLocations_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceSelectingEventArgs) Handles ODSLocations.Selecting
Dim ntid As DropDownList = CType(Me.Parent.FindControl("DDLEmployees"), DropDownList)
e.InputParameters("ntid") = ntid.SelectedValue
End Sub
View 2 Replies
Mar 9, 2011
I'm using a ListView (e.g topListView) with paged rows (using a DataPager). One of the topListView's features is when a user clicks on one of its rows, its SelectedValue property is used to populate a SelectParameter in another SQLDataSource control that populates another ListView (e.g. bottomListView). It's working fine. Even when the webpage first loads, the SelectedValue of first row of the topListView is successfully being used to generate content in the bottomListView.
However, when one of the DataPager's buttons is clicked, the SelectedValue seems to be ignored, and the bottomListView isn't refreshing. And yet, when you click a DataPager button again, it works. basically it's taking TWO clicks of the pager for the SelectedIndex to be read. I've tried assigning the SelectedIndex to 0 in the PagePropertiesChanged and PagePropertiesChanging handlers but no luck (even with calls to bottomListView.DataBind(); and/or SQLDataSource1.DataBind(); after index assignment).
assigning the index seems unecessary though, since top row content is being rendered correctly in a SelectedItemTemplate after clicking any DataPager button. to me that means the SelectedIndex is being set to 0 when the page is being re-rendered.
[Code]....
View 1 Replies
Mar 30, 2010
i have a db with two simple tables:
tbl_events:
-Event_ID int
-Event_Name varchar
-Event_Organiser varchar tbl_events_organisers
-Organiser_ID int
-Organiser_name varchar
In event_organiser of tbl_events i want to store the organiser_ID's of the second table in an array, so a record in the first table will like something like:
-Event_ID=18
-Event_Name=My event name
-Event_Organiser= 15,31,109,21
View 4 Replies
Oct 6, 2010
I am trying to insert a array into SQL with no luck. I get the string from a GPRS device that looks like this:
/WeightBridge.aspx?ReadeID=A1B5A0F5C4E4A1B5A0F5C4E4& agID=45B6C56A90B645B6C56A90B6,A47B1256A45F0843,B49B1256A45F08FF,30 SEP 2010 21:33:59,I,&Custom=Vehicle Num
All I want to do is to split the TagID array and insert it with the rest of the string into a SQL table. The TagID array must inserted into the following colomns in the DB. TagID, TID, UserMemory, DateTime and Direction. After the insert I just give a response that the insert was successfull or failed.
My code this far:
Imports System.Data.Sql
Imports System.Data.SqlClient
Partial Class WeightBridge
Inherits System.Web.UI.Page
[Code]....
View 2 Replies
Feb 24, 2010
I'm new to asp.net, php had this function that could store sql date in an array, I can't find something similar in .net, so this is what I came up with so far.
Sub Compareid()
Dim queryString As String = "Select top 2 id from my_videos order by id desc"
using connection As New SqlConnection(ConfigurationSettings.AppSettings("sqlacct")
[code]...
View 6 Replies
Jun 6, 2010
I have a gridview control that displays expenses claims received from clients. I have a template field that contains a checkbox - if this is ticked, a value from the gridview is added to a variable and this is outputted to a label control.
What I then want to do is to update the database according to which row has been ticked. I have so far the following code that adds each value to an array, which I was then hoping to access in the sql query i.e. Update table set value = value where id = (id's added to array)..
Code as follows - so far I'm just displaying the count of values in the array to make sure they are actually being added:
[Code]....
View 8 Replies
Mar 4, 2010
in ASP.net website C# code
example:
in SQL server, I have table TaxTable with column named TaxID, SalaryFrom like this:
TaxID SalaryFrom
1 1
2 2083.00
3 2500.00
4 3333.00
5 5000.00
6 7917.00
is there a way to store the values under salaryfrom column into an array?
note: In C# , Im using system.data.common.DbProviderFactories
this is so that I can read data from both sql server and mysql
View 2 Replies
Jan 11, 2010
i want fetch multiple values from the database and store in one local array and once again i will send it that multiple values to the database
View 4 Replies
Jun 16, 2010
I have a dataset that has around 5 rows. I also have another Datarow() array that has an additional 3 rows which I would want to add to the dataset. The structure of both the Dataset Rows and the Datarow arrays are the same.
Do I have to perform a loop on the datatrow arrays and add them one by one? or is there a better way of adding them in one go ?
View 3 Replies
Feb 22, 2010
using c#, i have an array where i want to test every single line of this array if it is already contained in a table of a database. if not, i do an insert. the test if the line is already in the table is performed using update, if update fails i insert the line. this works BUT the table contains 100000 entries, the arrays i want to compare/insert contain appr. 5000 entries. so, i is really slow and takes minutes.
View 7 Replies
Feb 4, 2010
I am using ASP.NET 2.0, C# and Sql Server 2005.I have 2 tables retruned by the stored procedure to the application. I am returning an Array from my datalayer to my bussiness layer and then to my UI layer.I have added the first table into the array and passing it to the UI layer. This is my current code:
[Code]....
How to pass the second table details to the same array, NameArrayKeyEntity .
View 3 Replies
Apr 6, 2010
I have an array of variables, and I want them to be stored in databse as arry, can I store an array inside one field ?
View 6 Replies
Jan 15, 2010
I have an array that I need to display using a feature like listview. Is that possible? I need to be able to display a "temporary" list of information that the user may add or delete entries. Once they approve the list I will loop through the list and store the information in a table.
View 4 Replies
Mar 19, 2010
I have am SqlParameterCollection and an arraylist. I want to be able to loop around both of them and take the SqlDBType of each parameter in the collection, and convert the value of the arraylist to the data type of the parameter.
[Code]....
View 4 Replies
Feb 2, 2010
I'm putting together a way to cull out bad emails from my table.
I have an email field, of course, and a 'fail' field (integer)
Each time I send out an email, I get a bunch of emails back that the email addresses were undeliverable, so I'd like to (manually), enter them all into an array (or whatever), and then run a stored procedure which updates the 'fail' field by 1
I'm looking for both on the SQL side (I have an sProc that does the deed one at a time - just need the logic to do it in a batch like this), and how to do it in the web page.....
View 3 Replies
Mar 11, 2010
My original code was in classic vb. and could use redim array to resize them. I was porting the code to c# now and lately i have run into an issue to resize a 2 dimensional array. The thing here is I have a 2 dimensional array whose 2nd dimension needs to be increased dynamically as needed to accommodate the data. For say
String[,] ary1=new String[2,10];
I'm doing some operation in a loop and filling in the data in ary1. And if the loop still continues, on reaching the ary1 upper bound i need to increase the size further to accommodate 10 more rows. I tried couple of ways to copy it to a bigger array and assign it back to the current array. but somehow dint work.
View 1 Replies
Mar 12, 2010
How can i send a string session array values to dataset? I have a session array where i stored textbox values. nowi want to send these values to dataset. how can i write the code in c# to send these values to dataset? I dnt want to save these values in database.
View 1 Replies
Jan 29, 2010
Trying to do a simple NOT IN cluase, but can't get the Linq syntax to do it.Basically, here's what I am trying to do ( in incorrect syntax):
[Code]....
So, I wasnt to select all rows where d.CD IS NOT one of the values contained in the string array.
View 2 Replies
Oct 3, 2010
I would like to know why somethimes DefaultValue in properties window is displayed in bold text and somethimes in normal weight text? What i know is that the Value in Properties Window should display bold only if the Value is different than DefaultValue.
So i have a situation, where i need to set DefaultValue's and i'm successfully setting the boolean Value but failing in Integer value...
aspx:
[Code]....
Now the reason why i'm using Int32 in this example is that i hovered the mouse over the DefaultValue and it's said that "represents a 32-bit signed integer" but still no luck.
Why is my StepHour displayed bold and how to display this DefaultValue in regular weight text?
View 7 Replies
Jan 13, 2011
I have an entitydatasoruce that is driving a gridview. I have a WHERE parameter that i want to include 2 default values (example Work_Area = 1 OR 2)But it seems I can not input this query when making a querystring within the expression editor
<asp:EntityDataSource
ID="RequestQueueEntityDataSource"
runat="server"
ConnectionString="name=tranreqEntities"
DefaultContainerName="tranreqEntities"
[code]...
View 2 Replies