w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Nested Repeaters in C#
There are plenty of examples available on internet. Following are some of that. http://www.codeproject.com/Tips/563919/Nested-Repeater-Controls-in-ASP-NET http://support.microsoft.com/kb/326338 From below link you can download the code also. http://everymanprogrammer.com/index.php/nested-repeaters-do-it-clean-and-simple-a-beginners-tutorial-part-2/

Categories : Asp Net

Accessing Nested repeaters
Repeaters have an ItemCommand event that I think would be useful for you. When the Button's Click event happens, the ItemCommand event will swallow it up if you haven't set the Button's Click event handler. On the ItemCommand event you can use the e arguments to determine which button, and the sender to determine which Repeater it came from. I was a little confused by your question, but I think this is the answer you're driving to. Does that help?

Categories : C#

How to get LinkButton text in nested Repeaters
What you should do is use the sender argument in the LinkButton_Click handler to get access to the instance of LinkButton that was actually clicked, and has raised the Click event: protected void LinkButton1_Click(object sender, EventArgs e) { // Use sender instead of trying to find the control within the Repeater LinkButton lnkBtnTags = (LinkButton) sender; Response.Redirect("~/WebsofWonder.aspx?tag=" + lnkBtnTags.Text); }

Categories : C#

C# Repeaters while amending some figures
As I understand from your explanation you need to repeat the same piece of HTML on many places with only difference of some values of some cells. So I suggest you create a new ASCX control. Webusercontrol is very similar to asp.net page, but has .ascx extension and can be inserted onto page or other control. So to create it use Add -> New Item -> Web User Control in VisualStudio. The web user control will have markup file .ascx and code-behind .ascx.cs file. Place your html on markup file: <div class="span3 finance-boxes"> <table class="table table-bordered table-hover finance-table"> <tr><td>Title</td></tr> <tr><td class="fig" runat="server" ID="cell1"></td></tr> <tr><td>Title</td>

Categories : C#

If statement in repeaters ItemTemplate
I would use codebehind: protected void OnCheckboxListItemBound(Object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { HtmlTableRow itemRow = (HtmlTableRow) e.Item.FindControl("itemRow"); itemRow.Visible = e.Item.ItemIndex % 2 == 0; } }

Categories : C#

How do I programmatically change the color behind a pager or repeaters select page number?
UserControl ASPX: <p> Page <asp:Label ID="currentPageLabel" runat="server" /> of <asp:Label ID="howManyPagesLabel" runat="server" /> | <asp:HyperLink ID="previousLink" Runat="server">Previous</asp:HyperLink> <asp:Repeater ID="pagesRepeater" runat="server" onitemdatabound="pagesRepeater_ItemDataBound"> <ItemTemplate> <asp:HyperLink ID="hyperlink" runat="server" Text='<%# Eval("Page") %>' NavigateUrl='<%# Eval("Url") %>' /> </ItemTemplate> </asp:Repeater> <asp:HyperLink ID="nextLink" Runat="server">Next</asp:HyperLink> </p> UserControl Code behind: public class p { public string Page { get; set; } public string Url { get; set; } public p(string url, stri

Categories : C#

Insert DataTable rows to DataBaseTables using DataAdapter: leave out one column in DataTable
string qry = "select * from PurchaseProduct where 0 = 1"; sa = new SqlDataAdapter(qry, conn); dataSet = new DataSet(); sa.Fill(dataSet); dataSet.Tables[0].Columns.Add("dtcolnPurchaseProductProductName",typeof(string));

Categories : Misc

Primefaces Datatable lost text in Filter field after datatable update
You can't (PrimeFaces 3.5) directly bind datatable filters with JSF bean, so they will not be preserved when you update the whole component. But if you call filter() on datatable widget, the data will be reloaded from server, without re-rendering the whole datatable component (so the filters will be preserved) <p:dataTable .... widgetVar="myTable"> ...</p:dataTable> <p:commandButton action="#{myBean.doSth}" .... oncomplete="myTable.filter()"/>

Categories : JSF

adding results of query against datatable to a column in another datatable in visual basic
You can always nest that in another query: select *, datediff(ms, startDate, endTime) from ( <your existing query here> ) t And while I'm here, it seems you need a lesson in parameterized queries: Dim result As New DataTable Dim Sql As String = _ "SELECT *, datediff(ms, startDate, endTime) FROM (" & _ "SELECT ID, startDate, codeID, Param, " & _ "(select top 1 startDate from myTable " & _ "where ID= @ID and Param = mt.param and codeID = 82 and startDate >= @startDate and startDate >=mt.startDate " & _ "ORDER BY startDate) endTime " & _ " FROM myTable mt " & _ " WHERE ID = @ID AND startDate between @startDate AND @endDate AND codeID = 81" & _ ") t" Using cn As New SqlConnection("c

Categories : SQL

For Loop of Datatable.rows breaks while exporting Datatable to excel in C# .Net
If I might offer an alternative: Use EPPLUS and its great LoadFromDataTable* Function - this would reduce your code to one line, it is magnitudes faster and it does not rely on Excel directly. Also: the library is free and can be included without licensing problems.

Categories : C#

Is there a way to create a datatable from an sql query and use datatable jquery filtering for it?
What happens when your javascript is called? Anything in the debugging Console window? You should attach your dataTable() call function to an event handler, like this: <script> $(document).ready(function () { $('#<%=GridView1.ClientID%>').dataTable(); }); </script> Have you checked the rendered HTML element to see if the table has and elements? I think JS dataTable requires it.

Categories : C#

JSF Primefaces datatable, first cell of first row is using previous datatable value when Columns tag is used
I have solved the problem. The issue seems to be when you create dynamic primefaces:datatables that use the primefaces:columns tag. When the data tables are created within a ui:repeat tag or using the primefaces:accordianPanel's looping ability, then every data table created after the first has a wrong value in the first cell of the first row. All other cells in the data table have the correct values. I have also noticed that the headerText is wrong and always from the previous data tables headerText (The first data table's headerText is always right). To solve this issue I placed the jstl:forEach tag inside of the primefaces:accordianPanel tag. This fixed the issue. It seems to be an issue with how the ui:repeat and/or the primefaces:accordianPanel is rendering the data tables. Here is t

Categories : JSF

select column from datatable and convert this to datatable again
This will create a new table, insert the single column, and populate with rows containing original data: DataTable dt = new DataTable(); DataColumn column = new DataColumn() { ColumnName = defindedDataTable.Columns[0].ColumnName, DataType = defindedDataTable.Columns[0].DataType, Expression = defindedDataTable.Columns[0].Expression, ColumnMapping = defindedDataTable.Columns[0].ColumnMapping }; dt.Columns.Add(column); foreach (DataRow row in defindedDataTable.Rows) { DataRow newRow = dt.NewRow(); newRow[defindedDataTable.Columns[0].ColumnName] = row[defindedDataTable.Columns[0].ColumnName]; dt.Rows.Add(newRow); }

Categories : C#

How to Compare Two Datatable and get common records in other DataTable in C#?
for(i=0;i<dt1.rows.count;i++) { if (dt2.rows.count > i) { if((dt1.rows[i][1] == dt2.rows[i][1]) && (dt1.rows[i][2] == dt2.rows[i][2])) { dt3.rows.add(dt.rows[i]) } } }

Categories : C#

.NET Convert the contents of a DataTable to another DataTable with a different schema
I would normally do in select that "looks like" the destination table, but with data from the source table. You would apply the data conversions also as required. Select Cast (LocationNameLocationName As varChar(...) As LocName , LocX As XCoord , ... From SourceTable Hard to describe in a simple answer. what I've done in the past is issue an "empty" query like "Select * From sourcetable Where 1=0" which returns no rows but makes all the columns and their types available in the result set. You can cycle through the column ADO objects to get the type of each. You can then use that info to dynamically build a real SQL statement with the conversions. You still have a lot of logic to decide the conversion, but they all happen as you're building the statement, not as the table is being r

Categories : SQL

Compare one datatable's rows to another datatable's columns
Not tested, but a simple loop on the dtReport columns collection checking if dtHeader columns collection contains a equal named column. If not remove the column from dtReport. SqlCommand cmdHeader = new SqlCommand("SELECT * FROM Header", conn); SqlCommand cmdReport = new SqlCommand("SELECT * FROM Report", conn); DataTable dtHeader = new DataTable(); DataTable dtReport = new DataTable(); SqlDataAdapter da1 = new SqlDataAdapter(cmdHeader); da1.Fill(dtHeader) SqlDataAdapter da2 = new SqlDataAdapter(cmdReport); da2.Fill(dtReport); for(int x = dtReport.Columns.Count - 1; x >= 0; x--) { DataColumn dc = dtReport.Columns[x]; if(!dtHeader.Columns.Contains(dc.ColumnName)) dtReport.Columns.Remove(dc.ColumnName); } The tri

Categories : C#

quickly Remove row from datatable which not find in another datatable
Try this (not tested), This should return you the list of rows those are both in dt1 and dt2 on the basis of id column (I am considering your id and id2 column is of type string) var rows = (from r1 in dt1.AsEnumerable() join r2 in dt2.AsEnumerable() on r1.Field<string>("id") equals r2.Field<string>("id2") select r1).ToList();

Categories : C#

SqlDataAdapter.Fill(DataTable) not filling DataTable
Even if zero rows were returned, the DataTable wouldn't be null. However, there is one place in this line: passBackRecords[i] = datatable.Rows[i].ToString(); that will fail -when passBackRecords is null. Another possible location is this: .Rows[i].ToString(); if the value in the row is null you'd also get a NullReferenceException when calling ToString(). But I'd almost put money on the fact that you've not yet initialized passBackRecords.

Categories : C#

How to delete row from specific datatable among multiple datatable?
This is how i pass data from one datatable to another (im using jquery 1.9) i assign oTable as a global javascript variable, then my table data as an object declared at the doc ready var oTable; $(document).ready(function() { var passData ={}; $(document).on("click", "#example tbody tr", function(){ var aPos = oTable.fnGetPosition(this); passData = oTable.fnGetData(aPos); }); passData is now available throughout my other doc ready event declarations after i have clicked on a row $('#someDiv').on('click', function(){ someFunction(passData); }); For your issue though, which i assume has a delete button on each row, i was thinking to set position as a variable aPos, global to the document ready, then executing your delete function var oTable; $(document).r

Categories : Jquery

Copy datatable as columns in another datatable
You can fire queries like: select col1,col2 into sourcetable1 from destTable union select col3,col4 into sourcetable2 from destTable union select col5,col6 into sourcetable3 from destTable union select col7,col8 into sourcetable4 from destTable Or, can follow technique mentioned over here. In case of data rows, it can be: foreach (DataRow row in DestTable) { SourceTable1.ImportRow(row); }

Categories : C#

Struts 1.1 nested and in combination
Use <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> and the code will look like <c:choose> <c:when test="${element.method1 == true}"> <c:choose> <c:when test="${element.method2 == true}"> <span style="color:green;"><c:out value="${element.prop1}/></span> </c:when> <c:otherwise> <span style="color:red;"><c:out value="${element.prop1}/></span> </c:otherwise> </c:choose> </c:when> <c:otherwise> <span style="color:black;"><c:out value="${element.prop1}/></span> </c:otherwise> </c:choose>

Categories : Java

How to have inherited DataRow class so inherited DataTable can have DataTable.NewRow()
If you can't simply use a DataTable with a single DataColumn of type int per @Tim's suggestion in the comments, then consider creating a typed DataTable. With a typed DataTable you can define column names and types as well as a number of other DataTable features and behaviors including how NewRow() works. A demonstration doing this can be found in this article over at codeproject.com: How to Manually Create a Typed DataTable A nice thing about typed DataTable is you don't need to 'indirectly' reference columns by index or by column name, you can reference columns using property notation with Visual Studio's Intellisense helping you out. Here's an example: var intDataTable = new YourTypedDataTable(); YourTypedDataRow row = intDataTable.NewRow(); row.Temp = 100; intDataTable.Rows.Add(

Categories : C#

JQuery selector for finding a nested span within a nested class is not working
I don't see any problem with your code at the moment, let's reformat it a bit: var tabs = $('.collapse').not('.in'); console.log("tabs.length: " + tabs.length); tabs.each(function () { var $this = $(this), thisErrors = $this.find('.field-validation-error'), thisId = '#' + $this.attr('id'); console.log("current tab ID: " + thisId); console.log("number of errors: " + thisErrors.length); if (thisErrors.length) { $(thisId).collapse('show'); } }); Or working fiddle: http://jsfiddle.net/Rq8y7/ Does it work now? And what's the debug message in console after you run above code?

Categories : Jquery

How can I bind data from nested List<> objects to nested ListView controls?
You can bind the datasource of your inner list view to a property of the items bound to your outer listview. However, to do that the inner listview as to be in the itemtemplate of the outer listview. See the code below and note the DataSource='<%# Eval("Labels_color") %>' attribute for the inner list view. <asp:ListView ID="ListView_Orp_Results" runat="server" ItemPlaceholderID="itemPlaceholder"> <LayoutTemplate> <div id="outer_result_container"> <div id="itemPlaceholder" /> </div> </LayoutTemplate> <ItemTemplate> <div id="result_photo">...</div> <div id="result_category">...</div> <div id="result_detector">...</div> <div id="inner_result_container" runat="server"

Categories : Asp Net

Parsing a flattly-written nested text template into a usable nested data structure for N levels
Replaces each ">" with a tab. Output is pretty much exactly as your brute force output. (file.txt is your template file as above) test = open("file.txt", "r") for line in test: print line.replace(">", " ") #print line

Categories : Python

nested json with jQuery: create List of nested item
Your problem is that institut is an array containing a single object, so you can reference that single object using institut[0]. This will work: $.each(data.fakultaeten, function (key, value) { var mother = "<li id='first'>" + value.name + "<ul>"; $.each(value.institut[0], function (key1, value1) { alert(key1); }); }); Here is a working example

Categories : Jquery

MySQL - Reference main query in nested select (need to be nested)
This cannot work. SELECT clause is always evaluated at the end of the execution chain, @teamg_id variable will always be 0 in the nested subquery. Try this query, it is not tested (I can't see your data, playing whith sample data always helps), but probably it gives desired results. I commented out some parts and add one join condition. /* SET @teamg_id := 0; */ SELECT /* @teamg_id := player.team_id, */ player.team_id AS player_team, event.local_team_id AS local_team, event.visitor_team_id AS visitor_team, action.unique_id AS action_id, action.player_id AS player_id, player.name AS player_name, playerindex.rank AS player_pos, playerindex.ses_var_nest AS ses_var_nest FROM er_players player

Categories : Mysql

How Can I Convert Nested YAML to nested Arrays and OpenStructs in Ruby
There is the solution (https://github.com/jsuchal/hashugar) i often use. opts = Hashugar.new({:a => 1, 'b' => {:c => 2, :d => [3, 4, {:e => 5}]}}) But you also need to do: opts.b.d.last.e I do not understand how do you want to name array's getters. As Arup Rakshit sayed: give us yaml example and expected output or behavior.

Categories : Ruby

Avoiding nested each loops when handling nested JSON data
JSON is "just" javascript object literals. You can skip the jQuery call, and just reference the objects and arrays directly after you parse it. obj.custom_sql_rule[0].something_else[0]; of course, your JSON is a bit oddly-formed. If at all possible, don't arbitrarily mix objects {} and arrays [] . Use the latter when you have lists of identical objects or primitive data, and the former when you have named properties. And once you have a valid javascript object, you can just iterate through its properties. for(var sqlProp in jsonObj) { if(jsonObj[sqlProp].error) { errorsContainer.append("<div>" + jsonObj[sqlProp].error + "</div>"); } }

Categories : Javascript

How to insert nested lists (or nested block elements) into RichTextBlock?
Ok Ill start with silverlight. There was a TreeView Control in silverlight that would have exactly solved your problem. Link to tree view example But since we already know that winRt is a subset of API's these controls have been removed for metro app. More over microsofts design policy regarding the Type Of scenario you are mentioning has changed to : Semantic Zoom For Metro Apps So i advise if your app requirement is like that Either go with the richtextbox or use Grids with Rows and columns Which ever suits your coding best. One more way is to use third party library for tree structure . Syncfusion tree control Syncfusion has a tree control you can try out in the Demo. Even there are more third party tool but none are free not even he above one. Please Let me know if any more co

Categories : HTML

Idiomatic Emberjs for nested routes but non-nested templates
You could define the parent template to just display the outlet and have an index route which will get displayed inside that. Then for the nested resource you can do the same thing. <script type="text/x-handlebars" data-template-name="user"> {{outlet}} </script> <script type="text/x-handlebars" data-template-name="user/index"> <h2>user/index</h2> </script> <script type="text/x-handlebars" data-template-name="posts"> {{outlet}} </script> <script type="text/x-handlebars" data-template-name="posts/index"> <h2>posts/index</h2> </script> That way it won't be a master/detail. The router would be: App.Router.map(function() { this.resource('user', function() { this.resource('posts', function() { }); });

Categories : Ember Js

nested attributes, passing current_user.id to nested model
'current_user' is a devise helper method. it can be accessed in controllers n views directly. if i m not wrong, only the new answer should have the current_user.id Old answers should not be updated. u can do this as f.fields_for :answers, @question.answers.build do |a| a.hidden_field :user_id, :value => current_user.id a.submit

Categories : Ruby On Rails

Nested ajax with nested rendered attribute in JSF
It is most likely what your ManagedBean is not in ViewScoped or SessionScoped. When you post back to the bean, you are loosing rendered states. I suggest to change for the ViewScoped one. Not related : You should remove the action attribute from the h:form since JSF override it.

Categories : JSF

how to remove nested entry in a nested map using dot notation
You could write your own method to do this, although you'd be likely to have to resort to a fair amount of casting. You'd probably just split on dots, then keep calling get (and remembering the result for the next step) until you got to the last part, at which point you'd call remove instead... remembering to check for a null return from get at every step. I don't know of anything built into a third party library to do this - which isn't to say it's nowhere, of course.

Categories : Java

PHP - Find nested array1 in nested array2
If I understand correctly what you are trying to achieve, you could do it like this (see comments in code): /* Process one needle (look into haystack and modify it accordingly) */ function processNeedle(&$haystack, $needle) { $needleKeys = array_keys($needle); $needleValues = array_values($needle); $needleLen = count($needle); $haystackLen = count($haystack); /* Find indexes where a match begins */ $matches = array(); for ($i = 0; $i < ($haystackLen - $needleLen + 1); $i++) { $match = true; for ($j = 0; $j < $needleLen; $j++) { if ($haystack[$i + $j]["v1"] != $needleKeys[$j]) { $match = false; break; } } if ($match) { $matches[] = $i;

Categories : PHP

PHP: Pull values foreach() nested array, run function, return a 2nd level nested array
foreach ($array as $key => $value){ $array[$key]['restaurants'] = work($value['id'],$value['name']); } function work($id,$name){ $results = array(); ///process data return $results; }

Categories : PHP

Creating a new nested list element that is a combination of two existing nested list elements (in R)
Here are your for loops using replicate (Note that the expression value for each replicate is the same expression you have in the assignment portion of your for loop) ## This is your inner for-loop, using replicate inds <- seq(begin, end, 10) datas <- replicate(length(inds), list('mean'=vector(mode='list',length=12),'sd'=vector(mode='list',length=12)) , simplify=FALSE) names(datas) <- inds # This is your outer loop tardis2 <- replicate(length(dataLayers), list('longName'='timeLord','units'='theDr','data'=datas) , simplify=FALSE) names(tardis2) <- dataLayers # Compare Results identical(tardis2, tardis) # [1] TRUE However, I'm not sure if lists are relaly the best structure for this. Have you considered data.frames?

Categories : R

Nested Repeater Puzzle: Using data returned from (outer) query, in a nested query
Couple of things that should be fixed here: The error "Server tag not well formed" was due to missed double quote after ConnectionString attribute. Remember that everything that goes inside <%# %> must be a valid C# code, which means that that if your are using a string - you should enclose it into double quotes. Typical pattern for quotes here is AttributeName='<%# Eval("Property")%>'. That was not the case in the SelectCommand value. When you need to manipulate with both literals and bound data, like in the select query here, it is better to enclose the whole expression in the servlet tags and perform necessary transformations inside. All in all, here is the result: <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSourceGrantCategories"> <Ite

Categories : C#

How to populate data into a nested table in Oracle when the nested table is within a record type
This document: http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/composites.htm#CIHIEBJC describes how to work with collection types in PL/SQL: Basic example: DECLARE TYPE N_TYPE IS TABLE OF VARCHAR2(350); TYPE TYPE1 IS RECORD ( FIELD_1 VARCHAR2(100) , FIELD_2 VARCHAR2(30) , FIELD_3 N_TYPE); v_n n_type; v_type1 type1; BEGIN v_n := n_type(); -- initialize an empty collection v_n.extend( 3 ); -- add 3 elements to the table v_n( 1 ) := 'First string '; v_n( 2 ) := 'Second string '; v_n( 3 ) := 'Third string '; v_n.extend; -- add 1 element at the end of the table v_n( v_n.last ) := 'Next string'; --assign the table to the field_3 of the record v_type1.field_3 := v_n; -- check values FOR i in v_typ

Categories : Oracle

sorting tr elements with nested tables, hide nested tbody while sorting
jsFiddle Demo At first I'd like to say that it's clear you really put effort in finding a solution on your own so it really made me want to help. The problem is that if you hide parts of the element after it begins to be dragged, the size isn't recalculated. The solution is like in the code you've linked. You have to catch a more preliminary event (like mousedown) and hide it before the dragging begins. $('tr.draggable_item').mousedown(function() { $(this).find("tbody").hide(); }); $('tr.draggable_item').mouseup(function() { $(this).find("tbody").show(); });

Categories : Jquery



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