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

Post New Web Links

how to store the datatable values into the 1-D array

Posted By:      Posted Date: October 25, 2010    Points: 0   Category :ASP.Net

hi all ,

how to store the datatable values into the 1-D array , i know in for loop ... other than that is there means let me know please

View Complete Post

More Related Resource Links

how to store array values into datarow


Hi I have   string array values in


Dim _arr_Entry_Ids() As String = Split(_Entry_Id, ",")

i want to store this array values in datatble column

dt = New DataTable


For i as integer 1 to 5

dr("v1") = _arr_Entry_Ids

dr("R1")="some text"


How to cast integer values as an array of enum values?


Hello all!

I'm working with VS2010 Beta2, ASP.NET and Dynamic Data. I'm using VB but will certainly be happy to receive a C# example if necessary. Laughing

I used a few of Steve's examples (Writing Attributes and Extension Methods for Dynamic Data and Dynamic Data - Hiding Columns in selected PageTemplates) to create a custom property attribute to be applied to a dynamic data column and want it to accept an array of enum values (each value will represent a dynamic data page template where this column should not be displayed).  My new attribute works fine when I hardcode it like this, meaning the HideColumnIn attribute is properly populated with the array of enum values:

<HideColumnIn(PageTemplate.List, PageTemplate.Edit)> _
Public Property My_DD_Column As Object


However, I want to store the values to be used for the HideColumnIn in the DB as integer values that correspond to the

How to store and retrieve multiple values in a single session variable .


I want to store employee name,designation and department in session variable and
retrieve in another page how to do this.

DataTable - How to get max and min values

Hi all, I have constructed a DataTable in the following way ---  DataTable projectedCPMdt = new DataTable();         projectedCPMdt.Columns.Add("ProjectedCPM", typeof(string));         projectedCPMdt.Columns.Add("0%", typeof(int));         projectedCPMdt.Columns.Add("1%", typeof(int));         projectedCPMdt.Columns.Add("2%", typeof(int));              projectedCPMdt.Rows.Add("70%", 1, 2, 3);         projectedCPMdt.Rows.Add("80%", 4, 5, 6);  DataTable projectedCPMdt = new DataTable();        projectedCPMdt.Columns.Add("ProjectedCPM", typeof(string));        projectedCPMdt.Columns.Add("0%", typeof(int));        projectedCPMdt.Columns.Add("1%", typeof(int));        projectedCPMdt.Columns.Add("2%", typeof(int));        projectedCPMdt.Rows.Add("70%", 1, 2, 3);        projectedCPMdt.Rows.Add("80%", 4, 5, 6);Its like a grid of values. And I need to select the max and min. In this case max = 6 and min =1.Can someone tlel me how to e

How to cast integer values to an array of enum values?

Hello all! I'm new to VB.NET (and OOP in general) and am struggling a bit...  I'm working with VS2010 Beta2, ASP.NET and Dynamic Data, however I'm thinking this question may be more related to VB so hopefully I've chosen the correct forum. I have a list of integer values stored in the DB and would like to cast them to an array of enum values so that they may be passed to my constructor.  The values in the DB directly correspond to the enum values.  Here is stripped down version of the code that hopefully highlights what I'm attempting to do:Private _pageTemplate() As PageTemplate Public Sub New(ByVal ParamArray pageTemplateArray As PageTemplate()) _pageTemplate = pageTemplateArray End Sub Public Enum PageTemplate Details = 1 Edit = 2 Insert = 3 List = 4 ListDetails = 5 End Enum What I'm having difficulty with is reading integer values from the DB and casting them to an array of PageTemplate() to be passed to the constructor above.  The integer values in the DB will be 1 through 5 to correspond to the enum values listed above.  Here is how I'm trying to build the ParamArray to be passed to the attribute constructor:Dim hideFieldsIn(-1) As PageTemplate Dim rowCount As Integer = -1 If reader.HasRows Then While reader.Read() rowCount += 1 ReDim hideFieldsIn(rowCount)

how to store the values in a object variable (package level scope) in a script component

I have declared a variable of object type with package level scope.  I want to assign values to this variable inside a script component.  My object should hold 5 columns in a row.  How to implement this ?

Reading in values in text file in a project solution to an array



I have a tab delimited text file that has 6 columns (all integers) and 500 rows (and no column headings) called ProjectData.txt that I have added to my Windows Form Application (c#) (by added I mean I have it in my project solution). 

I have declared an array in my code called ProjectDataArray which has dimensions [500, 6].

I wish to load each column of each row into the array.

All the code I have seen shows how to do this for text files that are not included in the project solution. 

Is this easy to do?

How do you store multi-dimensional array to viewstate?


How do you store multi-dimensional array to viewstate?  I am having a problem.  Here's what I did:

public bool[,,] regsettings = new bool[7,5,4];

bool[,,] regsettings = (bool[,,])ViewState["regsettings"];    // this line works!

regsettings[i,j,tab] = (bool)ViewState["regsettings"]; // this line no working?! The error is: Object reference not set to an instance of an object

the letters i,j,tab are just variables in the loop.  They are there.

I also tried: (bool[,,,]) as a cast and it is a no-go either.?


How to read PDF using Asp.net(C#.net) and store values in Database


Dear All,

Please try to guide me how to achieve this one. my application need to do reading the PDF document and want to store the values in Database.

Actually what happens is my customers sends me the OCR scanned copied in the form of PDF file. i need to read those scanned pdf files and store the customer information into my  table.

please try to help me how to do this..

Thanking uou,



Insert values into a datatable.



I have a datatable with 5 columns. Then i added another column "date" to this datatable.

I want to insert value  in every row for this column in this datatable.

When i use the following i am getting  Error-- ---- Conversion from type 'DataRow' to type 'Integer' is not valid.

How can i insert values into a datatable?



 Public Sub insertBrktoDB()

    Dim mydt As New DataTable
    mydt = BreaksCSV()
    Dim dt As DataColumn = New DataColumn("Date")
    dt.DataType = System.Type.GetType("System.DateTime")
    mydt.Columns.Add(dt) '--------------p_date is a property which has the value to be inserted
    p_date = ds_rte.Tables("sched").Rows(1).Item("mdate").ToString

Is it possible to pass an array of values, or a custom type as a parameter?


I am using a web service as a datasource.  When I create my report I would like to pass
a string array to this web method to retrieve the data for the report.  Is this possible or is there
a similar way to do this such as passing a custom type?





wroking on datatable to fetch only distinct values of particular column to assign to dropdown list.


As I kept my fetched datatables into session and accessing it on another page there I am

wroking on datatable to fetch only distinct values of particular column to assign to dropdown list.

Store Sorted GridView Data into a DataTable


I have a GridView that sorts and has paging features.  I need to grab the data from the SORTED DATA from the GRIDVIEW and put it into a DataTable. 

Who Do I get that sorted data gridview and store it into a DataTable.  I am an ASP.NET Programmer. YOUR HELP IS GREATLY NEEDED!

Goal: Get and Store Sorted GridView Data into a DataTable.  Your help is greatly appreciated in advanced.

Pass multiple values to an array parameter of an action


Hello guys,

ca anyone tell me how to get an url Like http://localhost/xxx/ControlerName/ActionName/2,3,4

to map to an Action having an int[] parameter?

For example to a Action with Signature:

1    public ActionResult Index(int[] ids)
2    {
4    }



1    public ActionResult Index(List<int> id)
2    {
4    }

I couldn't find any logic for doing this. So I've implemented an ActionFilterAttribute, but I would prefer to use an built in logic.
But if there's no built in logic, feel free to use my logic:



1    [ArrayOrListParameterAttribute("ids", ",")]
2    public ActionResult Index(List<int> ids)
3    {
5    }
7    [ArrayOrListParameterAttribute("ids", ","

How to store seesion values in page_load



I am new to dotnet.

I have two pages

First one is registration page.second one is Gridview page.

When i click on submitt button,the data will store in gridview.

If i want to update the data,click edit button.it will navigate to registration page with concer data.

I wrote code in first page as

            <td align="right">

                <asp:Label ID="lblUserId" runat="server" Font-Bold="True" 
                    ForeColor="Blue" Text="ClientId"></asp:Label>
            <td class="style4">
                <asp:TextBox ID="txtUserId" runat="server" Width="150" 
                    ontextchanged="txtUserId_TextChanged" AutoPostBack="True"></asp:TextBox>
            <asp:Label ID="lblUiddisplay" runat="server" Text="Label" ForeColor="Green" 
                    Font-Bold="True" Visible="False" ></asp:Label>
                <asp:RequiredFieldValidator ID="rfvUserId" runat="server" 
                    ControlToValidate="txtUserId" Er

How to get count of repeated values in datatable in asp.net.



I want total count of repeated values in a datable.


as shown in image total count should be : 2 because repeated values are only 1 and 2.

I tried as given below:

DataView dv = new DataView(dtTemp);
int iRowCount = dv.ToTable(true, "Column1").Rows.Count;

but it returns 3 which is incorrect.

Does anyone knows how to do it.

I don't want to use loop becoz sometimes data table contains 4000-5000 rows so if we use loop it will take much more time to get the total count.


WPF 4 DataGrid (Binding to DataTable), where store new value of user edit fields? DataGrid architect


I looking for good artical about the DataGrid architecture, logical & visual.

I try to understand whre datagrid store the new value of cell, when user edit row in DataGrid. I realize that DataGrid not hold Copy of data. instead it Hold pointer to DataRow. But DataRow got new value only after user end the line Edit.

the code like:

DirectCast(DataGrid1.CurrentCell.Item, System.Data.DataRowView).Item(1) 

return the DataRow, not the new value during line Edit.

My question

1. Where DataGrid Hold the new value?

2. How access to Visual Element of each cell, like TextBlock inside the cell from Code?

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