Search Results

Search found 1606 results on 65 pages for 'datasource'.

Page 44/65 | < Previous Page | 40 41 42 43 44 45 46 47 48 49 50 51  | Next Page >

  • Binding collections to DataGridView in Windows Forms

    - by Sergey
    I'm trying to bing collection to DataGridView. As it turns out it's impossible for user to edit anything in this DataGridView although EditMode is set to EditOnKeystrokeOrF2. Here is the simplified code: public Supplies() { InitializeComponent(); List<string> l = new <string>(); l.Add("hello"); this.SuppliesDataGridView.DataSource = l; } It also doesn't work when I change collection type to SortableBindingList, Dictionary or even use BindingSource. What can be wrong here?

    Read the article

  • IPhone: Controllers, Delagates, DataSources, etc all in one class?

    - by MLS
    Hi All, I am learning iPhone programming. I am starting with a simple example of displaying recently used documents in a UITableView. What I am confused about is why do I need to have several classes and why cant I just use one? Example, My class is called RecentFileList. I need to implement controller, delegate and datasource as well as the actual table view. Can't I just do this all in my RecentFileList Class versus having to create a RecentFileListDelegate RecentFileListController, RecentFileListDataSource class, etc, etc. Related to this can one define a class like: @interface FileListView : NSObject <UITableViewDelegate> <UITableViewController> <UITableViewDataSource { // code } @end or would I just do the work to make my class a delegate and controller in init()?

    Read the article

  • Dynamically add rows to listbox

    - by Ivan S
    I have a list box that displays information off of a column of a dataset. I would like the number of rows displayed to be all the rows that are in the dataset (the number of datasets in the rows vary). I'm figuring it has something to do with ListBox.Rows = Dataset.Tables[0].Rows.Count; But it seems to just always default to 4 even when it is only 2. This is what I have in my aspx.cs file. pirateBox.DataTextField = Pirateship.Tables[0].Columns["displayName"].ToString(); pirateBox.DataValueField = pirateship.Tables[0].Columns["PKID"].ToString(); pirateBox.DataSource = pirateship.Tables[0]; pirateBox.DataBind(); pirateBox.Rows = pirateship.Tables[0].Rows.Count; I've been trying a few things and this is what I have so far in .aspx <asp:ListBox ID="pirateBox" runat="server" Rows="1"></asp:ListBox>

    Read the article

  • how to build custom menu using asp.net

    - by Turi
    hi all, i have this situation: i have to build a menu with datasource from the db, because i have to filter them among the user that is loged in. i have tried building a menu using repeater, and all this works fine till i realized that i wanted the menu with more than two levels. i have also tried with treeview, but i really don't want this solution (problem with the style and the treeview doesn't have a pretty view). Could anyone give me any ideas ? thnx in advance.

    Read the article

  • Show data relationship in gridview with dropdownlist or similar?

    - by Anders Svensson
    I have data coming from two tables with a foreign key relationship - one User table containing users of the web application, and one Page table containing details about pages visited by each user. I would like to be able to view these data in a gridview or the like on a page. It's easy enough to just show the User table data like so (I'm using the Entity Framework and LINQ): UserDBEntities context = new UserDBEntities(); GridView1.DataSource = from user in context.UserSet select new { user.Ip, user.Count, user.Description, user.Referer }; GridView1.DataBind(); But how can I show the Page details? I'm not bent on any particular way of showing it, but the only idea I've been able to come up with is to have a dropdown list for each user in a column. But I can't figure out how to get the page data into such a dropdown list. The tables are associated with the primary/foreign key UserID. Any ideas would be welcome (dropdownlist solution or other)!

    Read the article

  • Wildcard in query for ASP.NET GridView

    - by cinu
    I am using GridView in ASP.NET 2.0. I am want to show the details from 3 tables (SQL2005) in the GridView per my search crieteria (Name of Visitor,Passport Number,Name of Company). It is working, but I want to use a wildcard for searching by first letter of "Name of Visitor". I have my code in the QueryBuilder in GridView (using Configure Datasource). The query is as follows: SELECT FormMaster.NameofCompany, VisitorMaster.NameofVisitor, VisitorMaster.PassportNumber, FormMaster.FormID, VisitorMaster.VisitorID FROM VisitorMaster INNER JOIN VisitorDetails ON VisitorMaster.VisitorID = VisitorDetails.VisitorID INNER JOIN FormMaster ON VisitorDetails.FormID = FormMaster.FormID WHERE (FormMaster.FormStatusID = 1) AND (VisitorMaster.PassportNumber = @PassportNumber ) OR (VisitorMaster.NameofVisitor = @NameofVisitor) OR (FormMaster.NameofCompany = @NameofCompany )

    Read the article

  • null reference exception was unhandled by user code

    - by user238319
    sir, i develop the following code in vs2005, now i just using this module in my new project @ vs 2008.. But this error was araised. I cant able to fix this problem... Private Sub DataAccess() Dim errHandle As New ErrorHandler Dim lobjCommon As New eCopsCommonFunctions Try AccessCodeDrplst.DataSource = CType(lobjCommon.gfuncGetAllEnrollmentSource(), DataSet) AccessCodeDrplst.DataValueField = "DataAccessCode" AccessCodeDrplst.DataTextField = "DataAccessDesc" AccessCodeDrplst.DataBind() 'lstEnrollmentSourceCode.DataValueField = "EnrollmentSourceCode" 'lstEnrollmentSourceCode.DataTextField = "EnrollmentSourceDesc" 'lstEnrollmentSourceCode.DataBind() '"Beneficiary Election" is pre selected as default value. By pals on Oct 24th 2007 'lstEnrollmentSourceCode.SelectedValue = "B" 'lstEnrollmentSourceCode.Items.Insert(0, New ListItem("Select", "0")) Catch ex As Exception errHandle.gProcHandleErrors(ex, Session("MemberID"), "SPStatus.aspx.vb, gprocFillSEPCode") Throw ex Finally lobjCommon = Nothing ///here the error occurs as 'NullException was unhandle by the user code' errHandle = Nothing End Try End Sub

    Read the article

  • Starting Game dev on iPhone:iPad - learning path ??

    - by Tibi
    Hi there, I'm beginning in iPhone/iPad game dev and I'm searching to set up my learning path. The basic features I would like to learn (after the basic SDK iphone components programming) are : using a board like interface where I can move pawn with my fingers detect where the pawn was moved and triggers events in the game The board will be constitute by 6 tiles that may be organised randomly when starting the game : may i use an sdk component with a delegate and datasource to determine where the pawn was left and on which tile ? need to use dices (which kind of library may I use ?) ... Do you have any idea about where to start ? ;-) Many thanks, Tib.

    Read the article

  • DataSet binding problem

    - by Shaine
    I've got in-memory dataset with some table defined and I populate this table in a following way: for(...) ds.Fields.AddFieldsRow(++j, 0, heading, "Char", "", "", "Input", 0, "","",""); On the GUI I've got DataGridView bound to that table inside TabControl (bound through BindingSource). Very strange thing is happening: if I open tab pane with this grid and populate table with some data then I see changes in grid. On the other side if I'm at other tab, populate table, and then switch to tab with grid I've got following exception: "DataMember property 'Fields' cannot be found on the DataSource". In similar way I've got 2 tab panes with grid in each that are bound to the same datatable using different datasources and I open one of them, populate, see the changes, then switch to second tab and get crash. What am I missing?

    Read the article

  • C# : Problem in creating diffrent types of columns in a gridview

    - by Royson
    My windows form application has a grid view control with filename as a default column. User should create a column of following types Text, Number, Currency, Combo Box, Check Box, Radio Button ,Date time type (should display DateTimePicker control) and Hyper Link type. After that i want to pass all rows to next screen for further processing. We can create a column of these types in a grid view but how can i store it in a data table so that i can pass it to next screen. Or should i create a column in a data table and then assign data table to grid view by gridview.DataSource = dt; but can we create a these types of columns in a data table. I am so confused!! Please help me to solve this problem. Thanks

    Read the article

  • ASP.Net databinding in tag

    - by Psytronic
    I know you can bind in the code-behind, but I don't quite understand how it works if you want to declare it within the controls tag. This is for a custom collection. I thought it was just Datasource="<%# MyCollection %" Where MyCollection is an exposed property of the class in the code behind? MyCollection{ get{ return _MyCollection;}} Something like that. But it doesn't seem to work that way, so can I not bind this way, or am I missing something?

    Read the article

  • C# Web gridview sortin

    - by tommypiaa
    Any examples how would I enable sorting for the gridview? private void loadlist() { cn.Open(); cmd.CommandText = "select Breed, Name, Image from Animals"; dr = cmd.ExecuteReader(); cn.Close(); } protected void TextBox1_TextChanged(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { AddData(); Addimage(); } protected void AddData() { if (TextBox1.Text != "" & TextBox2.Text != "") { cn.Open(); cmd.CommandText = "insert into Animals (Breed, Name) values ('" + TextBox1.Text + "', '" + TextBox2.Text + "')"; cmd.ExecuteNonQuery(); cmd.Clone(); cn.Close(); loadlist(); } } protected void DisplayData() { cn.Open(); cmd.CommandText = "select Breed, Name from Animals"; dr = cmd.ExecuteReader(); GridView1.DataSource = dr; GridView1.DataBind(); cn.Close(); }

    Read the article

  • ASP.NET JSON Binding data with RadiobuttonList

    - by user1385570
    I'm trying to bind JSON data into the RadioButtonList on client side. I know how to do the in code behind, it works fine. Someone please provide more details, How do I bind the JSON data RadioButtionList in VB.NET. rblregions.DataTextField = "Value" rblregions.DataValueField = "Key" rblregions.DataSource = items The data looks like: [regions:{regionID:US,regionName:USA}] main.aspx <asp:RadioButtonList ID="rblregions" runat="server"> $.getJSON("Map/loadMySites.aspx?" + query, function (data) { if (data.regionid && data.region) { //I want to bind the data here with RadioButtonList } } );

    Read the article

  • check compiler with break point

    - by KareemSaad
    When I tried to focus on compiler in code i made break point on code if (!IsPostBack) { using (SqlConnection Con = Connection.GetConnection()) { if (Request.QueryString["Category_Id"] != null && DDlProductFamily.SelectedIndex < 0) { SqlCommand Com = new SqlCommand("SelectAllCtageories_Front", Con); Com.CommandType = CommandType.StoredProcedure; Com.Parameters.Add(Parameter.NewInt("@Category_Id", Request.QueryString["Category_Id"])); SqlDataAdapter DA = new SqlDataAdapter(Com); DA.Fill(dt); DataList1.DataSource = dt; DataList1.DataBind(); } but I cannot check condition although I had the value of query string List item

    Read the article

  • Sorting records datewise in datatable.

    - by Harikrishna
    I have datatable and I am storing the records in that datatable. Now one of the column in the datatable is type of DateTime.That column I added by code Table.Columns.Add(new DataColumn("TradingDate",System.Type.GetType("System.DateTime"))); Now I want to sort the records datewise in ascending order. I have used following code but the records are not sorted. DataView view = new DataView(Table); view.Sort = "TradingDate ASC"; dataGridView1.DataSource=view.Table; But records are not sorted so how to do it ?

    Read the article

  • Index out of range, but why?

    - by Stuart
    I have a gridview, and i have a SelectedIndexChanged event on it... protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { GridViewRow Row = GridView1.SelectedRow; //do some stuff } Then i get an error... Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index I dont understand why, the Gridview is being binded in pageload. but not in post back... if (!IsPostBack) { GridView1.DataSource = UserAccounts; GridView1.DataBind(); }

    Read the article

  • How do I tell if the ObjectDataSource OnSelected event was called for the selectmethod or selectcou

    - by itchi
    I have an object datasource that looks like this: <asp:ObjectDataSource ID="obdsList" runat="server" EnablePaging="True" SelectCountMethod="GetCountByID" SortParameterName="sortExpression" OldValuesParameterFormatString="original_{0}" SelectMethod="GetByID" TypeName="Services.Users" onselected="obdsList_Selected"> <SelectParameters> <asp:QueryStringParameter Name="ID" QueryStringField="ID" Type="Int32" /> </SelectParameters> </asp:ObjectDataSource> And a onselected event like this: protected void obdsList_Selected(object sender, ObjectDataSourceStatusEventArgs e) { } However, the event method is being called twice.. once with my returned list, and once with the returned Int32 count. If I want to cast e.ReturnValue to the return List how do I differentiate between the count and select methods? I can do a e.ReturnValue.GetType().ToString() but that seems like a hack.

    Read the article

  • How to build a LINQ query from text at runtime?

    - by Danvil
    I have a class A { public int X; public double Y; public string Z; // and more fields/properties ... }; and a List<A> data and can build a linq query like e.g. var q = from a in data where a.X > 20 select new {a.Y, a.Z}; Then dataGridView1.DataSource = q.ToList(); displays the selection in my DataGridView. Now the question, is it possible to build the query from a text the user has entered at runtime? Like var q = QueryFromText("from a in data where a.X > 20 select new {a.Y, a.Z}"); The point being, that the user (having programming skills) can dynamically and freely select the displayed data.

    Read the article

  • Unusual conversion error (string to integer) asp.net

    - by Phil
    I have my repeater item template: <ItemTemplate> <tr><td><%#Container.DataItem("Category")%></td></tr> </ItemTemplate> Hooked up to: s = "SQL that works ok on server" x = New SqlCommand(s, c) x.Parameters.Add("@contentid", SqlDbType.Int) x.Parameters("@contentid").Value = contentid c.Open() r = x.ExecuteReader If r.HasRows Then Linksrepeater.DataSource = r Linksrepeater.DataBind() End If c.Close() r.Close() When I run the code I get: Invalid Cast Exception was not handled by user code (Conversion from string "category" to type 'Integer' is not valid.) I'm not sure how / why it is trying to convert "Category" to integer as in the db it is a string. Can you please tell me how to avoid this error? thanks.

    Read the article

  • Gridview SortExpression with 2 fields

    - by aron
    Hello, I have a GridView that get's its datasource from a complex object. So I'm doing the Sorting & Paging in the code behind. <asp:GridView ID="SystemsDetailList" runat="server" AllowSorting="true" AllowPaging="true" AutoGenerateColumns="False" ShowFooter="True" OnPageIndexChanging="gridView_PageIndexChanging" OnSorting="gridView_Sorting"> For an important title column I have a SortExpression with 2 fields: SortExpression="FunctionalAreaDisplayCode, EswbsDisplayCode" This in the code behind: protected void gridView_Sorting(object sender, GridViewSortEventArgs e) { BindSystemList(e.SortExpression, sortOrder); } public string sortOrder { get { if (ViewState["sortOrder"].ToString() == "desc") { ViewState["sortOrder"] = "asc"; } else { ViewState["sortOrder"] = "desc"; } return ViewState["sortOrder"].ToString(); } set { ViewState["sortOrder"] = value; } } For some reason it will keep "FunctionalAreaDisplayCode" always sorted ASC but the EswbsDisplayCode works fine as it flips between ASC and DESC correctly. and tips here? thanks!

    Read the article

  • Need help in c# code

    - by vaibhav
    I have a function protected void bindCurrencies(DropDownList drp) { drp.DataSource = dtCurrencies; drp.DataTextField = "CurrencyName"; drp.DataValueField = "CurrencyID"; drp.DataBind(); drp.Items.Insert(0, new ListItem("Please Select")); } I am binding a dropdown list using this. But sometimes I need to bind a ListBox also. I dont want to write a different function for listbox. How should I do this. I think Generics method is to be used here. But I dont have any idea about generics.

    Read the article

  • How to get the right row in a sorted DataView?

    - by ZeissS
    Hi, I have a DataGrid containing a small table. Until now, I had a double click handler on this grid which iterated over all rows to find the selected one: DataTable table = (DataTable)this.dataGrid.DataSource; int selectedRow = -1; for (int i=0; i<table.Rows.Count; i++) if (this.dataGrid.IsSelected(i)) selectedRow = i; break; } if ( selectedRow != -1 ) { DataRow row = table.Rows[selectedRow]; // More code ... } Problem: When the user clicks on a column header and sort the table, table.Rows does not return the right rows. It still contains the unsorted rows. How can I get the right column?

    Read the article

  • New records added to DataGridView aren't displayed

    - by Ross
    I have a custom Order class, groups of which are stored in List<Order> and a DataGridView. I think the problem is in my implementation so here's how I'm using it: In the form enclosing DataGridView (as OrdersDataGrid): public partial class MainForm : Form { public static List<Order> Orders; public MainForm() { // code to populate Orders with values, otherwise sets Orders to new List<Order>(); OrdersDataGrid.DataSource = Orders; } Then in another form that adds an Order: // Save event public void Save(object sender, EventArgs e) { Order order = BuildOrder(); // method that constructs an order object from form data MainForm.Orders.Add(order); } From what I can tell from the console this is added successfully. I thought the DataGrid would be updated automatically after this since Orders has changed - is there something I'm missing? The DataGrid accepts the class since it generates columns from the members.

    Read the article

  • I want search a item frome database

    - by vishal
    I want search a item frome database bye date and id but if I want to search only by date or id tahn data are display but if I want to search by both date and id than not both are display but combine both and than display. my code: SqlConnection con = new SqlConnection("Data Source=NODE5-PC;Initial Catalog=hans;Persist Security Info=True;User ID=sa;Password=123"); cmd = new SqlCommand("SELECT UserId, Date, Report FROM Daily_Report WHERE (Date='" + txtdate.Text + "' or UserId='" + txtempid.Text + "') OR (UserId='" + txtempid.Text + "' and UserId='" + txtempid.Text + "')", con); con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); GridView2.DataSource = rdr; GridView2.DataBind(); con.Close();

    Read the article

< Previous Page | 40 41 42 43 44 45 46 47 48 49 50 51  | Next Page >