w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Gridview returning empty even when there is data. I want to use data in the gridview to update another database
Per my comment above you may want to do something like: List<string> _OrderIds = new List<string>(); DataTable table = gvOrderLines.DataSource as DataTable; foreach (GridViewRow gvr in table.Rows) { Label myOrderIDLablel = (Label)gvr.FindControl("lblOrderID"); //find control since it is a template field _OrderIds.Add(myOrderIDLablel.Text); } I hope this get you headed in the right direction.

Categories : C#

How to display an image based on the coulmn value from the database in gridview?
if you have runat="server" you cant use eny logic unless you do it in your code behind file. Change it to img <img ID="Image4" src='<%# (Eval("is_selected").ToString()=="1" ? "~/images/tick.png" : "~/images/cross.png" %>' /> if you want to do it code behind: add OnItemDataBound="GridView2_ItemDataBound" to <asp:GridView> Add this to codeBehind public void GridView2_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item) { NameOfTheObject item = (NameOfTheObject)e.Item.DataItem; Image image = (HiddenField)e.Item.FindControl("Image4"); image.ImageUrl= item.is_selected==1 ? "~/images/tick.png" : "~/images/cross.png"; } }

Categories : Asp Net

Change button text in asp:gridview based on cell value C#
<asp:GridView ID="gridView1" runat="server" OnRowDataBound="gview_RowDataBound" OnRowCommand="gview_RowCommand" AutoGenerateColumns="False"> <Columns> <asp:TemplateField HeaderText="Active Status"> <ItemTemplate> <asp:Label ID="Active" runat="server" Text='<%# Eval("IsActive") %>'></asp:Label> <asp:Button runat="server" ID="buttonChangeActiveStatus" CommandName="<%# Eval("IsActive") %>" CommandArgument="<%# Eval("IsActive") %>" OnClick="buttonChangeActiveStatus_Click" Text="" />

Categories : C#

how i can insert data into database from gridview
Try this SqlConnection connStr = new SqlConnection ("Data Source=SERVER;Initial Catalog=HRPR;Persist Security Info=True;User ID=hr;Password=11"); SqlCommand com; protected void Button2_Click(object sender, EventArgs e) { SqlConnection connStr = new SqlConnection("Data Source=SERVER;Initial Catalog=HRPR;Persist Security Info=True;User ID=hr;Password=11"); connStr.Open(); foreach (DataGridViewRow row in dataGridView.SelectedRows) { com = new SqlCommand("INSERT INTO tblExmWrittn(column1,column2....) VALUES( '" + row.Cells[0].Value.ToString(); + "', '" + row.Cells[1].Value.ToString();+ "' , '" + row.Cells[2].Value.ToString();+ "' ,'" + row.Cells[3].Value.ToString();+ "','" + row.Cells[4].Value.ToString();+ "' ,'" + row.Cells[5].Value.ToString();+ "','"

Categories : C#

Displaying of the data in the gridview based on the search criteria using generics concept of .net
I assume you know ado.net and how to bind gridview. You just need to iterate through your database resultset and add it to list and bind it. Following link might help you to begin with: http://www.aspsnippets.com/Articles/How-to-bind-GridView-with-Generic-List-in-ASPNet-using-C-and-VBNet.aspx Pass your textbox value to your database query/stored procedure as parameter and return the result based on search value. Edit: You may want to use FindAll, Find method. Check below link: http://msdn.microsoft.com/en-us/library/aa701359(VS.80).aspx

Categories : Asp Net

Windows StoreApp XAML: Changing ItemTemplate in GridView based on Data type
GridView exposes this through the ItemTemplateSelector property which is a class you can create that inherits from DataTemplateSelector. An example would be that I have a GridView that has Issues and Repositories bound to it and want to use different data templates for each. My data template selector looks like: public class IssueSummaryTemplateSelector : DataTemplateSelector { protected override DataTemplate SelectTemplateCore(object item, DependencyObject container) { return item is IssueGroupViewModel ? IssueTemplate : RepositoryTemplate; } public DataTemplate RepositoryTemplate { get; set; } public DataTemplate IssueTemplate { get; set; } } I then declare the selector as a Resource in xaml assigning the t

Categories : Xaml

How to edit, update and delete in gridview when data comes from database?
There are lots of tutorials about asp gridview control in the net. You just have to search for it. To get you started, this link should give you the first steps. Additional link. Hope that helps!

Categories : Database

Counting records from database and inserting data into a GridView
you can do it by simple join query in database . try following query : SELECT A.ID , SUM(CASE WHEN B.ID IS NOT NULL THEN 1 ELSE 0 END) AS TOTALNOOFPEOPLE FROM DEPARTMENT AS A LEFT OUTER JOIN PEOPLE AS B ON A.ID = B.DEPARTMENTID GROUP BY A.ID

Categories : C#

Retrieve data from database and store in string and bind all the strings to gridview
You can loop through your DataTable returned from your stored procedure in the database, like this: // Iterate through the columns of the DataTable to set the BoundFields dynamically foreach (DataColumn theDataColumn in theDataTable.Columns) { // Instantiate new BoundField BoundField theBoundField = new BoundField(); // Set the DataField value theBoundField.DataField = theDataColumn.ColumnName; // Set the HeaderText value theBoundField.HeaderText = theDataColumn.ColumnName; // Add BoundField to the GridView GridView1.Columns.Add(theBoundField); }

Categories : Asp Net

How to change the row color based on data that can change in a tableview?
try this its perfectly worked... tablecol.setCellFactory(new Callback<TableColumn<CheckDo, String>, TableCell<CheckDo, String>>() { @Override public TableCell<CheckDo, String> call(TableColumn<CheckDo, String> p) { return new TableCell<CheckDo, String>() { @Override public void updateItem(String item, boolean empty) { super.updateItem(item, empty); if (!isEmpty()) this.setStyle("-fx-background-color:red"); this.getTableRow().setStyle("-fx-background-color:red"); setText(item); } } };

Categories : CSS

schedule to update database based on the change of another db
I ended up create an extra "last_updated" column in my server db and use that column to identify whether the row is changed after some time point. I know this is a bit skewed from my original question. Yet it is a straightforward and easy way to achieve what I wanted.

Categories : Java

Change the name of column in Gridview on runtime when sorting of gridview is enabled
I'm guessing you're trying to use AutoGenerateColumns? If this is the case why can't you change the column name in the datasource (using "AS" if the datasource is SQL)? Otherwise, your altering the cell text is short-circuiting the ASP.NET functionality which generates the sorting javascript postback. Alternatively you would do this if you don't use AutoGenerateColumns: myGrid.Columns[1].HeaderText = "test1";

Categories : C#

display gridview data in another page or other gridview with row data in editable mode
You need to add RowCommand Event in GridView. <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowCommand="GridView1_RowCommand"> <asp:LinkButton ID ="lnkEdit" runat ="server" CommandArgument='<%#Eval("Recordid")%>' CommandName ="cmdEdit" Text ='Edit'></asp:LinkButton> </asp:GridView> Here rocordid is the id of your record. In Page behind you need to write code. protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "cmdEdit") { string Recordid = Convert.ToString(e.CommandArgument.ToString()); Response.Redirect("EditPage.aspx?recordid="+Recordid ); } } On EditPage you can get recordid from the query string and can fetch the record form the datab

Categories : Asp Net

Retrieving Data from database on quaterly basis condition But it should be based on current year data only
use this in your query to find record filter by year YEAR( '20013-12-12' ) example, SELECT * FROM TABLE WHERE YEAR(DATE_FIELD) = 2013

Categories : Mysql

how do you change a database filter based on a link you click in django?
Basically, you can make this work by using named groups in your urls.py patterns, e.g.: (r'^links/(?P<value>w+)/$', display) Then, you can access saved part of url inside your view, like: def display(request, value=None): print value And, of course, you should use appropriate url in the template: <td><a href="links/{{ status.rootgroup }}/"> {{ status.rootgroup }} </a></td> Also see documentation.

Categories : Python

How to Change text color based on Access Database values Asp.net
I would setup a style first for the two colors you want then just implement the following in a OnDataBinding event that you could re-use for other labels if necessary: <asp:Label id="TWALabel" runat="server" OnDataBinding="YourLabel_DataBinding" /> Then in your C# code: protected void YourLabel_DataBinding(object sender, System.EventArgs e) { Label lbl = (Label)(sender); int TWA = (int)(Eval("TWA")); lbl.Text = TWA.ToString(); if (TWA >= 85) { if (TWA < 90) { lbl.CssClass = "yourYellowClass"; } else { lbl.CssClass = "yourRedClass"; } } // else do nothing since below 85 just have the default as green (eg. yourGreenClass)... }

Categories : Javascript

How to Change data based on key press
try following: echo your list in "li" format, and then copy paste below code to your editor // on keydown on text box $txtInput.on("keyup", function (e) { var txt = $(this).val().toLowerCase(); //for backspace if (e.which == 8) { if (txt.length == 0) { renderList(arrText); } } if (txt.length >= 1) { var filterList = searchInList(arrText, txt); if (filterList.length > 0) { renderList(filterList); } else { console.log("Not Found"); renderList(arrText); } } }); see full example here: http://jsfiddle.net/m25UW/ i hope it helps.

Categories : PHP

How to generate table rows based on data in database
Since you are loading all of your results into an array you can use array_chunk to break the array into rows and then output accordingly. $array = array_chunk($array, 4); echo '<table style="width: 100%; height:85%;table-layout:fixed;text-align:center;">'; foreach($array as $row){ echo "<tr>"; foreach($row as $cell){ // echo out your tds for format each cell here. } echo "</tr>"; } echo '</table>';

Categories : PHP

Retrieve Data based on code in access database c#
Supposing that Description is a column of the table where you read the code, then it is mandatory that you add that column in the list of fields retrieved by your query OleDbDataReader dReader; string cmdText="SELECT [Code], [Description] FROM [Data] WHERE Code=@Code" using(OleDbConnection conn = new OleDbConnection(connectionString)) using(OleDbCommand cmd = new OleDbCommand(cmdText, conn)) { conn.Open(); cmd.Parameters.Add(new OleDbParameter("@Code", OleDbType.VarChar, 200, "Code")); cmd.Parameters["@Code"].Value = textBoxCodeContainer[0][y].Text; using(OleDbDFataReader dReader = cmd.ExecuteReader()) { AutoCompleteStringCollection codesCollection = new AutoCompleteStringCollection(); while (dReader.Read()) { string numString = dRea

Categories : C#

display data from database based on drop down selection
Does table_load.php return HTML elements? From the JQuery documentation: Description: Load data from the server and place the returned HTML into the matched element. Your PHP script needs to generate HTML elements to be inserted into the container. Also, you don't really need the selector, this will be sufficient: var id = $(this).val();

Categories : Javascript

Change UICollectionViewCell content and nib layout based on data
You should register each nib file you need in viewDidLoad, something like this (substituting the correct names for the nib file and the identifier): [self.collectionView registerNib:[UINib nibWithNibName:@"RDCell" bundle:nil] forCellWithReuseIdentifier:@"FirstType"]; Then, in itemForRowAtIndexPath, test for type and return the correct type of cell: - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { if (type = @"firstType") { FirstCell *cell = (FirstCell *) [collectionView dequeueReusableCellWithReuseIdentifier:@"FirstType" forIndexPath:indexPath]; return cell; }else{ SecondCell *cell = (SecondCell *) [collectionView dequeueReusableCellWithReuseIdentifier:@"Sec

Categories : Iphone

Sharing data between Android App and database based windows server
There are some easy steps which can help you. 1. Create a listener in asp.net which will be hosted on IIS. 2. Call listener from mobile device via HTTP. 3. Call stored procedure or simple sql statements to fetch data from database and send back to mobile device in the form of Http Response(text,xml,json).

Categories : Android

How to create a partial database dump based on a specific set of data?
It's a good question. Oracle released a test management pack in 12c that i think takes care of that - I haven't got into it so much but maybe it's compatible with 11g as well. Informatica has a similar product. If you don't want to use a pricey solution you may be able to use the COPY command. The principal of the sqlplus COPY command is similar to the old exp/imp but it allows you to export using a query. 1.Export lookup tables. 2.Export main (fact) table with a filter. copy from=user/pass@prod to user/pass@test create big_fact using select * from big_Fact where update_date > '01/01/2013' 3.Copy related table by joining to the base table copy from=user/pass@prod to user/pass@test create related_table1 using select related_table1.* from related_table1 join big_fact on (jo

Categories : Java

R: How to change the column names in a data frame based on a specification
One way, where x is your df: controls <- which(substring(names(x),4,4) %in% c("H","K")) cases <- which(substring(names(x),4,4) %in% c("X","V")) names(x)[controls] <- gsub("SM","Control",names(x)[controls]) names(x)[cases] <- gsub("SM","Case",names(x)[cases]) Alternatively: names(x) <- sapply(names(x),function(z) { if(substring(z,4,4) %in% c("H","K")) sub("SM","Control",z) else if(substring(z,4,4) %in% c("X","V")) sub("SM","Case",z) })

Categories : String

Change cell value of DataGrid based on column data type
Use the event AutoGeneratingColumn and attach a converter to the column's binding. Event private void DataGrid_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e) { if (e.PropertyType.Equals(typeof(DateTime))) { var column = (DataGridTextColumn)e.Column; var dateTimeConverter = new DateTimeConverter(); ((Binding)column.Binding).Converter = dateTimeConverter; } } Converter public class DateTimeConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return "Override This"; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.C

Categories : C#

Gridview onRowCommand fired gridview no data
Problem in this line ID = gvWorkshop.DataKeys[grdrow.RowIndex]["workshopID"].ToString(); You have mention "grdrow" in place of "row". please change it to ID = gvWorkshop.DataKeys[row.RowIndex]["workshopID"].ToString();

Categories : C#

which node.js embed database having a Browser based Console to watch the data
Here are two potential candidates: LevelDB NodeJS Module : https://github.com/rvagg/node-levelup "Fast & simple storage - a Node.js-style LevelDB wrapper" Memory-Only Back-end for the API : https://github.com/rvagg/node-memdown "A drop-in replacement for LevelDOWN that works in memory only"

Categories : Database

I need to change the color some data in the ListView rows based on value of a special column
Are you using a DataTemplate and Binding for your ListBox? If so, you can just bind the background of your DataTemplate's main container(eg. grid) to a property in your model. The first answer in this question should work:- How to add different background colors to alternate rows to list box items windows phone 8

Categories : C#

how to write sql statement for exporting data based on conditions from database to Excel in MVC3
What Have u tried till now to export to excel. There are different dll available to interact with Excel "EPPLUS" is one of them . You can find its tutorial on http://www.jimmycollins.org/blog/?p=547 You can retrieve data using your conditions through stored procedure or query then can bind that data to excel. Edited Part:- For jquery ajax call $('#Exportbtn').click(function () { var drpdownval= $("#DROPDOWN").val();//This Is your selected value $.ajax({ cache:false, type: "POST", url: "@(Url.Action("ExportProducts", "Order"))", //Method and controller to which u r going to pass the data data:"drpdownval=" + drpdownval,

Categories : Asp Net Mvc

Change Label Control Property Based on Data from SqlDataSource Inside a Repeater
Try chaning your code from this: <asp:Label ID="lbl_category" runat="server" CssClass="<%# Eval("CommentType") %>" to this: <asp:Label ID="lbl_category" runat="server" CssClass='<%# Eval("CommentType") %>' />

Categories : C#

Change background/highlight-color of selected ListBox item based on data
You can use a Trigger to achieve that: <Style TargetType="ListBoxItem"> <Style.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="Background"> <Setter.Value> <SolidColorBrush Color="{Binding Color}" /> </Setter.Value> </Setter> </Trigger> </Style.Triggers> </Style> Note that for this binding to work, you must have a property called Color on the data item objects that are set as the ListBox.ItemsSource. UPDATE >>> Ok, so that was my bad... I forgot that SolidColorBrush is not a FrameworkElement and is Freezable, so they cannot be used in a Binding... you have a few options: Either create your colour(

Categories : Wpf

Change data type of property in neo4j database
Simple. Use the Java API instead. for(Relationship r: node.getRelationships()){ Integer p = (Integer) r.getProperty("value"); } This is assuming that the Relationship contains property with Integer as property. If not, then get the String and do Integer.parseInt on the String. This is the simplest way to do it. In general I prefer the Java api over cypher. Better performance and more control

Categories : Java

Is there any event which is called whenever there is a change in the MYSQL database data?
You could use triggers as presented in the comments. Problem with that: a trigger can only be triggered to execute an sql statemnt. So you could us a trigger, and create some kind of "activity" table with proper indexes. Problem: you still need to check this activity table! To reduce load, you should write a server component to your chat program that notifeis all clients. This way, only the server has to check to database regularly and not each client. Without more information what language you are writing in, we can not help you more I guess.

Categories : Mysql

Change the data of database dynamically without changing the frame in swing
Since your program acesses a database, I assume that you are using ResultSet from JDBC. You need to call ResultSet.next() each time the user clicks on the "Next" button. As long as you keep a reference to the ResultSet, you can call this method until you reach the end of the data set.

Categories : Java

Get all the data from the database first time and if any entries got changed then print out only the change
You need to add extra column in the table called last modified(date with time). Every time querying to the database you pass the last access time(for example getFromDatabase(last access time) ). You need to keep your last access time in you program. In the query you need to verify the last access time against the last modified field.

Categories : Java

Trying to use query variable and form data to change tables in database
What if $_GET['id'] is not set? it will fail. Also please read up into correct usage of SQL in PHP. Your code is vulnerable to SQL injection attacks and whatnot. EDIT: updated piece of code if(isset$_GET['id'] && is_numeric($_GET['id'])) { $ware_number = $_GET['id']; Echo "<form action='usernamecheck.php?id=" . $_GET['id'] . "' method='post'>"; .....

Categories : PHP

Python, MySQL, load data from database, change it, save it again?
cur.execute returns the number of rows affected - in your case, just 1 row, which is why it always returns 1. To get the actual value, you need to do cur.fetchone(), which will return a tuple of values - again, in your case, a tuple containing a single int. Just an additional tip, since this is a 'learn Python' exercise: global variables are usually frowned on. You should pass xp explicitly into your gainxp function.

Categories : Python

Editable gridview based on list
Here is an example: private class Person { int m_iID; string m_sName; string m_sZip; public int ID { get { return m_iID; } } public string Name { get { return m_sName; } } public string Zip { get { return m_sZip; } } public Person(int iID, string sName, string sZip) { m_iID = iID; m_sName = sName; m_sZip = sZip; } } private List<Person> m_People; private void ConvertListToDataTable(List<Person> People) { DataTable table = new DataTable(); DataColumn col1 = new DataColumn("ID"); DataColumn col2 = new DataColumn("Name"); DataColumn col3 = new DataColumn("Zip"); col1.DataType = System.Type.GetType("System

Categories : Asp Net

GridView with templatefield that changes based on a property
Why don't you make just one <ItemTemplate> that has server controls inside of it and then you can show/hide the ones that do or do not meet the conditions, like this: Markup: <asp:TemplateField HeaderText="Time" HeaderStyle-CssClass="table-header-repeat line-left" SortExpression="WaitingFor"> <ItemTemplate> <asp:Label id="Seconds" runat="server" style="color: #006600; font-weight: bold;"></asp:Label> <br /> <asp:Label id="ProgressBar" ruant="server" data-ordernr="<%# Eval("OrderId") %>" CssClass="progressBar" data-waitingfor="<%# Eval("WaitingFor") %>">[ Loading Progress Bar ]</asp:Label> <asp:Label id="NotApplicable" runat="server" Visible="False">Not applicable</asp:Label> <

Categories : Asp Net

Populate gridview based on two dropdown lists
You can call something like this on dropdownlist change, or via a button click. (Not sure how you have that configured) //import and add the System.Data.SqlClient Namespace using System.Data.SqlClient; try //Try block for opening, querying and displaying pulled data { sqlConn.Open(); cmdstring = "Select col1, col2, col3 from tablename where field 1 = '" + ddllist1.selecteditem.value+ "' and field2 = '" + ddllist2.selecteditem.value + "'"; sqlcmd01 = new SqlCommand(cmdstring, sqlConn); reader01 = sqlcmd01.ExecuteReader(); //set the datasource and bind it to the gridview gridview01.DataSource = reader01; gridview01.DataBind(); sqlConn.Close(); } catch (Except

Categories : Asp Net



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.