Concatenate Two Cells Into A Single Cell?

Jun 30, 2010

Query for Concatinate two cells into a single cell



ADVERTISEMENT

SQL Reporting :: Joined Tables - Concatenate Rows Into Single Row?

Feb 13, 2010

Im having a go at doing a report for my asp.net application. I have 2 tables, one which lists a loan we have given to a customer, and another table which lists repayments against the loans.

I want to display each loan and how much is outstanding against it. My problem is that each loan is repeated in the table for each repayment against it. So when i try to sum up the loans awarded to a customer, if they only have one loan and have made 3 repayments against it, it sums up the amount awarded against each record.

eg, if i award a customer a loan of 200, and they make 3 repayments of 50, 3 records appear in the table. The amount awarded is repeated against each repayment, and when i total a customers loan amounts, it totals 3 x 200.

I have put the details into the grouping row, where it is grouped by loan_id, displaying the toal of repayments instead of each repayment. This stops it repeating in the table, but when i total the amount awarded field it still calculates 3 x 200.

I tried calculating the total on the report item after grouping but you cannot calculate on a report item.

Is there a way to stop the table from repeating the amount awarded against each repayment? Or even a way in the SQL statement of the dataset to make it display a total of repayments rather than each repayment. Cant see how to calculate a total repaid as i would need to pass a Loan_id in as a parameter.

View 3 Replies View Related

SQL Server :: How To Concatenate Multiple Rows Of Single Table

Mar 8, 2011

I've a table where one person teaches multiple classes. It looks like this.

Table1

Id Name Class Subject
----------------------------------------
2 Sam 12 English
2 Sam 10 Maths
2 Sam 10 English
2 Sam 8 History
2 Sam 12 Economics

Here Sam teaches Class 12 - English & Economics, Class 10 - Maths & English, Class 8 - History

I want to display the result like this -

Id Name Class Subject
---------------------------------------------------------------
2 Sam 12 English, Economics
2 Sam 10 Maths, English
2 Sam 8 History

How to concatenate multiple Rows?

View 6 Replies View Related

Forms Data Controls :: Concatenate Gridview Rows To Single String

Jan 28, 2010

i need to concatenate the gridview rows to a single string if the gridview count is more than 100 then i need to perform the concatenation as 100 comma seperated and the next has to be carried over to the next string say if the count of gridview is 1000 then i need to concatenate the string as string1= 1to 100(Ex: a,b,c....) then string2=101-200 string3= 201-300... and so on. in case if i had to use String builder for this.. tel me how to proceed with this.

View 2 Replies View Related

Preserve Spaces In GridView Cells When Cell Contents Added In C# Code-behind?

Jun 27, 2007

I'm trying to provide functionality for a client where his Excel spreadsheet will be displayed on webpages as-is. I was able to implement the reading of Excel worksheets with Koogra (sourceforge.net). Now, I'm pulling my hair out trying to preserve what Excel's Accounting format for cells has. In Excel, the value 5,000,000 is displayed as '$ 5,000,000' using the Accounting cell format. I finally figured out the correct .NET format to make a Double formatted the same (see code below). But when I render the gridview, all imbedded spaces are removed - NOT what I need to show. HOW do I preserve the spaces? BTW, when I was curious to know if/how Excel handled this when I save the worksheet as an html formatted file, it uses a style with 'mso-spacerun:yes' but I can't find ANY documentation on that or if that would be available on a GoDaddy website. Again - trying to preserve content including spaces from the C# code-behind to populate GridView cells.

[Code]....

View 10 Replies View Related

Forms Data Controls :: Gridview Edit Cells And Auto Update Total In Another Cell?

Dec 4, 2009

My goal is to use Gridview control to behave somewhat like an excel spreadsheet...

where the user can change/enter a value in Cell1

where the user can change/enter a value in Cell2

Cell3 automatically gets updated with the total of (Cell1 * Cell2). Assuming of course that a formula was placed in Cell3.

In this case ... each row will have EditLink enable.

The user clicks on EditLink.. and the button is replaced with "Update" "Cancel" links.

txtCompensationPercentPayout is now editable

txtCommissionPayoutGross is now editable

The user enters/changes the value of txtCompensationPercentPayout and tabs to the next field. At this time... I'd like lblCommissionPayoutNet to be updated with the total. The user enters/changes the value of txtCommissionPayoutGross and tabs to the next field. At this time... I'd like lblCommissionPayoutNet to be updated with the total.

[code]....

View 2 Replies View Related

Forms Data Controls :: Make Specific Cells In A Dynamic Gridview Clickable And Capture The Cell Info Before Redirecting

Aug 3, 2010

I generate dynamic grids based on a count value returned from some DB tables. the code for it goes like this : I give and Id to each grid that is generated.

if (myDataList1.Count >= 1)
{
for (int i = 0; i < myDataList1.Count; i++)
{
//retrieving the exact i count from pageload
ViewState.Add("newCount", i);
//creating the dynamic grid with its corresponding gridview properties.
grvDynamic = new GridView();
grvDynamic.ID = "GridView" + (i+3);
grvDynamic.AutoGenerateColumns = false;
grvDynamic.RowCreated += GridViewRowCreated;
grvDynamic.RowDataBound += grvDynamic_RowDataBound;
//adding bound field columns to retrieve data from stored proc
BoundField metric = new BoundField();
metric.HeaderText = "Goal ";
metric.DataField = "metric";
grvDynamic.Columns.Add(metric);
BoundField mtd = new BoundField();
mtd.HeaderText = "MTD";
mtd.DataField = "value_MTD";
grvDynamic.Columns.Add(mtd);
BoundField goal = new BoundField();
goal.HeaderText = "Tier Level Achieved";
goal.DataField = "value_goal";
goal.HeaderStyle.Width = Unit.Percentage(10);
grvDynamic.Columns.Add(goal);
BoundField you1 = new BoundField();
you1.HeaderText = "Month End";
you1.DataField = "firstLevel_you";
grvDynamic.Columns.Add(you1);
BoundField you2 = new BoundField();
you2.HeaderText = "Month End";
you2.DataField = "secondLevel_you";
grvDynamic.Columns.Add(you2);
ButtonField singleClick = new ButtonField();
singleClick.CommandName = "clickHyperlink";
singleClick.Visible = false;
grvDynamic.Columns.Add(singleClick);
BoundField metricId = new BoundField();
metricId.HeaderText = "Metric Id";
metricId.DataField = "metricID";
metricId.Visible = true;
grvDynamic.Columns.Add(metricId);
//binding the gridview to data.
grvDynamic.DataSource = data;
grvDynamic.DataBind();
grvDynamic.Columns[5].Visible = false;
}
}

protected void grvDynamic_RowDataBound(object sender, GridViewRowEventArgs e)
{
//this basically gets the metric Id's of rows with the ishyperlink flag set to 'Y'. I need to make these particular cells clickable var isClickable = (from md in myDataList3 where md.IsHyperLinkFlag == 'Y' &&

md.value_MTD != null select md.metricID).ToList();
if (e.Row.RowType == DataControlRowType.DataRow)
{
// Get reference to button field in the gridview.
LinkButton _singleClickButton = (LinkButton)e.Row.Cells[5].Controls[0];

if (isClickable.Contains(Convert.ToInt32(e.Row.Cells[6].Text)))
{
e.Row.Cells[1].Style["cursor"] = "hand";
e.Row.Cells[1].Style["color"] = "blue";
e.Row.Cells[1].Style["textdecoration"] = "Underline";
e.Row.Cells[1].Attributes.Add("onClick", "window.location ='../HeaderPages/page2.aspx' ");
}
}
}

This code works perfectly fine , depending on the ishyperlink flag in the database...specific cells in the grid are made clickable and then redirected to page2.aspx My Issue: I need to capture which specific cell in which specific grid the user has clicked. store some information in sessions based on the cell clicked and use that information in page2.aspx.

View 5 Replies View Related

ADO.NET :: Convert SQL Concatenate To LINQ Concatenate Query?

Oct 20, 2010

convert the code below to LINQ, converting my project to a wseb version usimg LINQ To SQL. The project contains 10 textboxes to possibly select from, but I'm only providing the first two textboxes to simplify my question.

mySQL_Statement = "SELECT IDENTIFICATION_DATA.NSC,ITEMISCD.RNC,ITEMISCD.NSC1 FROM IDENTIFICATION_DATA LEFT OUTER JOIN ITEMISCD on IDENTIFICATION_DATA.NIIN = ITEMISCD.NIIN"
If Not ((TextBox1.Text = String.Empty) And (TextBox2.Text = String.Empty) Then
mySQL_Statement = mySQL_Statement + " where "
If Not (TextBox1.Text = String.Empty) Then
mySQL_Statement = mySQL_Statement + "IDENTIFICATION_DATA.NSC IN (" + TextBox1.Text & ")"
End If
If (TextBox1.Text = String.Empty) Then
mySQL_Statement = mySQL_Statement + "isnull(IDENTIFICATION_DATA.NIIN) = FALSE"
End If
If Not (TextBox2.Text = String.Empty) Then
If astrixState = 0 Then
If Not (TextBox1.Text = String.Empty) Then
mySQL_Statement = mySQL_Statement + " AND IDENTIFICATION_DATA.NIIN IN (" + TextBox2.Text & ")"
ElseIf (TextBox1.Text = String.Empty) Then
mySQL_Statement = mySQL_Statement + " AND IDENTIFICATION_DATA.NIIN IN (" + TextBox2.Text & ")"
MsgBox(mySQL_Statement)
End If
End If
If astrixState = 1 Then
If Not (TextBox1.Text = String.Empty) Then
mySQL_Statement = mySQL_Statement + " OR IDENTIFICATION_DATA.NIIN IN (" + TextBox2.Text & ")"
Else
mySQL_Statement = mySQL_Statement + " AND IDENTIFICATION_DATA.NIIN IN (" + TextBox2.Text & ")"
End If
End If
If astrixState = 2 Then
If Not (TextBox1.Text = String.Empty) Then
mySQL_Statement = mySQL_Statement + "AND IDENTIFICATION_DATA.NIIN NOT IN (" + TextBox2.Text & ")"
Else
mySQL_Statement = mySQL_Statement + " AND IDENTIFICATION_DATA.NIIN NOT IN (" + TextBox2.Text & ")"
End If
End If
End If

View 12 Replies View Related

Multiple Single Cell Gridviews Update

Jan 6, 2009

I am trying to get an update to work, but am having endless problems. I don't know if what I am doing is possible or if I am even going about it the right way. I have numerous Gridviews that are bound to a single sqldatasource. Each Gridview shows one field of a table based on the selection from a drop down box. The reasoning behind this is to be able to space out the information and include a bit of whitespace to make everything more presentable. Each gridview is made editable (by using editindex=0) to allow the user to update the presented information.

When I try to update the gridviews through an onclick event with sqldatasource5.update() nothing happens. If I use each individual gvAddress.Updaterow(gvaddress.editindex(), true), gvCity.Updaterow(gvCity.editindex(), true), etc only the first update occurs. All other fields become null. Now I can see the reasoning behind this as this event is updating all rows from the UpdateCommand in sqldatasource5 and each time the event is called only one field has data in it. I have included some code below to show what is going on.....

<asp:SqlDataSource
ID="SqlDataSource5"
runat="server"
ConnectionString="<%&#36; ConnectionStrings:GOAServerConnectionString %>"
SelectCommand="SELECT [ContactID], [Department], [Address], [City], [State], [PostCode], [WorkPhone], [HomePhone], [MobilePhone], [FaxNumber], [EmailName], [ContactType], [Note] FROM
[Contacts] WHERE ([ContactID] = @ContactID)"
UpdateCommand="UPDATE [Contacts] SET [Department] = @Department, [Address] = @Address, [City] = @City, [State] = @State, [PostCode] = @PostCode, [WorkPhone] = @WorkPhone, [HomePhone]
= @HomePhone, [MobilePhone] = @MobilePhone, [FaxNumber] = @FaxNumber, [EmailName] = @EmailName, [ContactType] = @ContactType, [Note] = @Note WHERE [ContactID] = @ContactID"
>
<SelectParameters>
<asp:ControlParameter
ControlID="ddlName"
Name="ContactID"
PropertyName="SelectedValue"
Type="Int32"
/>
</SelectParameters>
<UpdateParameters>
<asp:Parameter
Name="Department"
Type="String"
/>
<asp:Parameter
Name="Address"
Type="String"
/>
<asp:Parameter
Name="City"
Type="String"
/>
<asp:Parameter
Name="State"
Type="String"
/>
<asp:Parameter
Name="PostCode"
Type="Int16"
/>
<asp:Parameter
Name="WorkPhone"
Type="String"
/>
<asp:Parameter
Name="HomePhone"
Type="String"
/>..................

View 1 Replies View Related

Forms Data Controls :: Changing Value In Single Cell?

Dec 14, 2010

I have a gridview which shows the contents of the shopping cart. The qty cell is a template control bound to the qty field in the datasource. My ideal scenario is to have the user highlit the qty, write the new one and press 'enter' to update the sqldatasource but this may not be possible.

My second chose is an Update button to update the data but this erases the data from the other fields not listed as key.

I have tried the edit and update functions but then all fields are editable and I dont't want that, just the qty cell. If I change the read only atrribute to true on the ones that I don't want edited, then it erases the information from those fields.

View 6 Replies View Related

C# - Saving Multiple Items Per Single Database Cell?

May 13, 2010

i have a countries list. Each user can check multiple countries. Once saved, this "user country list" will be used to get whether other users fit into countries certain user chose.

Question is what would be the most efficient approach to this problem...

I have one, one to save user selection as delimited list like Canada,USA,France ... in single varchar(max) field but problem with it would be that once user from Germany enters page i perform this check on. To search for Germany i would be needed to get all items and un-delimit each field to check against value or to use sql 'like' which again is pretty damn slow...

Just to make sure, many users will have their own selections of countries from which and only they want to have users to land on their page. While millions of users will reach those pages. So the faster approach will be the better.

technology, MSSQL and ASP.NET

View 5 Replies View Related

Databases :: How To Update Single Cell Of Excel Sheet Using Oledb Connection

Feb 2, 2008

i got some codes from net by using that i can update a excel sheet ,but there we have to specify some header fields name in command string like as fallows ,

Update [Sheet1$] set ProductName="IBG" where ProductId=5

but i want to update a single cell of excel sheet only,let say O12 cell i want to change somedata,how it is possible that i don't know.

View 13 Replies View Related

Forms Data Controls :: Gridview Multiple Hyperlink In A Single Cell?

Feb 23, 2011

How to add individual hyperlink on comma separated values in single cell? For Eg: I have customer name comma separated in a single cell. I want each customer name as a single individual link.

View 2 Replies View Related

Forms Data Controls :: Mixture Of Formatted Text Within A Single GridView Cell?

Jun 28, 2010

Using Visual Studio 2008 (but have VWD 2010 available). Desire is populate a cell from a number of database items that have been concatenated together. Exampler would be Smith, John, 2010, Going After an Ideal Solution, 500 pages. Gridview allows me to set the cell format, but for the entire cell. I would like to present this as a mixture.

View 6 Replies View Related

Forms Data Controls :: How To Show Textbox In Gridview Cell Like Excel Cell

Nov 5, 2009

I want to show Gridview cell like Excel cell, I don't want to show Textbox.

Am writting this code in gridview.

<asp:TemplateField HeaderText ="1 St Week">
<ItemTemplate >
<asp:Label ID ="lbl1week" runat ="server" Text ="Present"></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID ="txt1week" runat ="server" ></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>

View 2 Replies View Related

Forms Data Controls :: Gridview And Sql Bit - Check The Cell With The Bit Value To Change The Cell Color

Apr 30, 2010

I have a grid view populated with some data included bit fields and I made an export to excel function For each row i need to check the cell with the bit value to change the cell color, but the cell is always empty, even if is the field is set to False or True. foreach (GridViewRow row in gv.Rows)

View 2 Replies View Related

Web Forms :: Menu Control Blank Cell / Remove Empty Cell?

Sep 16, 2009

I am using ASP.Net Menu Control with following properties

<asp:Menu ID="gNav" StaticTopSeparatorImageUrl="/_layouts/images/Avnet/globalNavSeparator.gif" StaticBottomSeparatorImageUrl="/_layouts/images/Avnet/globalNavSeparator.gif" runat="server" Orientation="Horizontal" StaticEnableDefaultPopOutImage="false">

However, when I run the code a black cell is automatically created to the right-hand of each menuitem at the toplevel. This is giving me problems in centering the text.

This empty cell has width of 3px. Can anyone please help me findout how to remove this empty cell.

View 9 Replies View Related

Forms Data Controls :: GridView Control Cell Turns Grey When Updating Cell?

Feb 11, 2010

I'm having a weird problem where the GridView cell that I'm programmatically updating turns grey, and throws a null error when attempting to save row. I have been searching all day and have not been able to find a solution. I'm guessing there is a problem with my code, so here it is:

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

View 5 Replies View Related

Forms Data Controls :: How To Set Height And ItemSource (Business Object As DataSource For Cell) For Every Cell

Mar 24, 2010

How to set Height and ItemSource(Business Object as DataSource for Cell) for every Cell in DataGrid/ Grid? Shown below is part of code I am currently using with Grid Control. What I am currently doing is that I am using ListBoxItem, set Item Height and ItemSource at ListBoxItem Level, Add ListBoxitem to ListBox and then Add ListBox to Grid, It leaves me with just one row and multiple columns in the Grid, which is perhaps not the best way of doing it as it doesn't allow me to take benefits from UI Virtualization of Grid.

[code]....

I am open to use any control i.e. Grid/ DataGrid provided it allows me to set Cell Height and item source at Cell level. In my requirement, Cell height depends on the Item duration and size of image, which means the height of the cells may not be same across cells in any particular row.

View 3 Replies View Related

Forms Data Controls :: How To Cell Editing Clicking In A Particular Cell

Sep 30, 2009

I have been trying to edit just a cell on row of the grid, but i didnt know how do implant it.

There is a telerik grid on page where this grid has 4 columns. The type of coluns are the following:
textbox, textbox, textbox and combobox.

the first textbox its type is numeric, the second is a date and third is character.

I show how the grid will be:

price | date | name | city
$1.89 9/10/2009 James New york

the combobox city there is a list of cities where It gets in database

When the page shows, the grid shows too with all the registers with it.

when the user clicks in some cell the cell show a field for example a textbox for user types there.

There must be validation in all fields. Numeric field must just permit numeric characters, date field only date...

I need to implement it on code behind. Is it possible?

View 6 Replies View Related

C# - How To Fill Gridview Cell-by-cell Only With Available Amount Of Images

Mar 8, 2010

I want to populate GridView below with images:

<asp:GridView ID="GrdDynamic" runat="server" AutoGenerateColumns="False">
<Columns>
</Columns>
</asp:GridView>

The code below iterates through directory, then I collect image titles and want them to be populated in gridview. code in bold is not working well, gridview is only filled with the last image in list.

how to fill gridview cell-by-cell only with available amount of images?

View 1 Replies View Related

MVC :: Concatenate SQL Results?

Mar 23, 2011

I am working on an application that requires a lot of data sets being sent to the client when application starts. To avoid multiple trips to the server I want to combine all the data together and send it as one piece. I cannot build one single SQL statement, it's going to be many. Should I just put SQL results together like strings?

View 14 Replies View Related

Concatenate String And Use As Variable Name?

Nov 18, 2008

What I'm doing is I'm sending a parameter with the URL like show.aspx?d=1 and on another page receive it with response.querystring("d"). Then I have a bunch of strings j1, j2, j3... I'm trying to concatenate the number with the letter "j" like response.write("j" & d) to write the string but it's never that easy, is it? I also tried to first put it in another variable like showd = "j" & d then response.write(showD) but to the same effect...

Actually I'm trying to make something like a christmas calendar, where it would show a different joke every day...So how do I fix this?

View 14 Replies View Related

Concatenate Two Strings With Delimiter

Apr 1, 2009

want to concatenate two strings with delimiter '-' ,the problem is if the second string is null also ,'-' displays.(eg)

string1 ="test"
string2=null
result = test-
expected result = test

View 8 Replies View Related

SQL Server :: How To Concatenate The Row Values

Jul 30, 2010

I want to concatenate the row values in field.I am having 123 rows in one column.So i have to insert those 123 row values into 123 column values.

For that I used cursor now i m getting the result like this

1000,
2000,
3000,

So i want this values in one row so that i can write that in insert query to insert those values in other table as multiple column values.

View 1 Replies View Related

Evaluate Expression To Add Not To Concatenate?

Oct 10, 2010

I am preparing string expression to use it to insert statement like

str="insert into franchise (xx,yyy,xxxxx) values (" + rblxx.SelectedIndex + 1 .............

when I do so it simply concats the thing like value of rblxx.SelectedIndex "0" and 1 makes 01 and not 1.suggest some function and trick to add the numeric values not concat. I tried using System.Convert.ToInt32 but not worked for me.

View 2 Replies View Related

ADO.NET :: Concatenate Linq To String?

Sep 24, 2010

Below is sample linqtosql, is there possible to concate linq in select statement.becuz i wan to return vary number of column

[Code]....

[Code]....

View 3 Replies View Related

C# - Concatenate The Html Tag And Textbox.text

Feb 12, 2010

i need to concatenate the html tag like <br/> and to the textbox.text in asp.net textbox. i have used this txtMessage.Text + <br/> + strgetlist; but it is displaying TaskName<br/>Project1,project2.. how to give break and space between thest two.

View 4 Replies View Related

Concatenate Two Session Values In Web Application?

May 10, 2010

concatnate two session values. I need to concatnate

Session["probmgremail"].ToString();and Session["TextBox2"].ToString();

The output should be a combination of two values seperated by a semicolon(;).

The session values are email address.

View 2 Replies View Related

DataSource Controls :: Concatenate TableName With Int?

Jun 7, 2010

I have the following code:

[Code]....

In this line, I wanted to assign the table to the datatable of dtCA1 and dtCA2.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved