Forms Data Controls :: Why Dataformat String Not Working

Mar 28, 2011

why my dataformat string is not working. Below is the code I am using

<asp:BoundField HeaderText="Log Date" DataField="Log_Date" DataFormatString="{0:dd/MM/yy HH:mm}" ItemStyle-Font-Names="Arial" ItemStyle-Font-Size="13px" ItemStyle-HorizontalAlign="Right" HtmlEncode="false"/>

I need this in around 6 to 7 places. When I changed it everywhere to the same as above, it worked in only 2 places but others are not working. Its the same but dont know whats the reason.

View 5 Replies


Similar Messages:

Unable To Apply Dataformat String To Bound Columns Of Datagrid Generated Dynamically

Jan 17, 2011

following is sample code i am trying to make work. i want to apply formatting to datagrid column "price" i want price to be shown in currency format

Dim bColumn As BoundColumn
bColumn = New BoundColumn
bColumn.HeaderText = "name"
bColumn.DataField = "name"
dgBizDocs.Columns.Add(bColumn)
bColumn = New BoundColumn
bColumn.HeaderText = "price"
bColumn.DataField = "price"
bColumn.DataFormatString = "{0:C}" ' already tried following "{0:#,##0.00}"
dgBizDocs.Columns.Add(bColumn)
Dim dt As New DataTable
dt.Columns.Add("name")
dt.Columns.Add("price")
Dim dr As DataRow
dr = dt.NewRow
dr("name") = "ABC"
dr("price") = 1232100.53
dt.Rows.Add(dr)
dr = dt.NewRow
dr("name") = "ABC"
dr("price") = 123123.32
dt.Rows.Add(dr)
dt.AcceptChanges()
dgBizDocs.DataSource = dt
dgBizDocs.DataBind()

what am i doing wrong ?

View 2 Replies

Forms Data Controls :: String.Format Not Working In ListView Control?

Aug 5, 2010

I have a ListView control that pulls a phone number from a db table. I'd like to format the phone number in the presentation layer to look like (###) ###-####.

The code line currently looks like this. The page displays the phone# but unformatted, i.e. 9999999999.

[Code]....

Based on other posts I've looked at in this forum, I've also tried:

<li>Phone: <%# String.Format("{0:(###) ###-####}", Databinder.Eval (Container.DataItem("Phone"))) %> with no success. In fact, this particular line throws an exception in my application (Input string not in the correct format).

The datatype I'm using in SQL is varchar(15)

The MSDN documentation for the String.Format method hasn't been very helpful thus far.

View 20 Replies

Forms Data Controls :: How To Display The String Data Stored In A String[] Variable Into Gridview

Jul 16, 2010

How to display the string data stored in a string[] variable into gridview?

View 9 Replies

Forms Data Controls :: Change The Date Format From String To String At Gridview?

Feb 24, 2011

i facing a problem to change the date format at gridview display.

below is my coding:

[code]....

View 2 Replies

Forms Data Controls :: Replacing All Occurrences Of A String With Another String?

Dec 15, 2010

i have a gridview and i want all occurences of a particular string inside the gridview to be replaced with another string.

View 5 Replies

Forms Data Controls :: Export To Excel Not Working At Ie8 But Working At Firefox3

Apr 26, 2010

I want to export the grid data to excel then write the following code but the following lines of code are working at firefox3 but not at ie8(no response).

System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.AddHeader("Content-disposition", "attachment;filename=ProjectTimeSheet.xls");
System.Web.HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";
string excelFile = "";
excelFile = ConvertToExcel(PrepareGridViewForExport()); //generate formated table for excel
System.Web.HttpContext.Current.Response.Write(excelFile);
System.Web.HttpContext.Current.Response.End();

View 4 Replies

DropDownList Data Binding To List <String> Not Working?

Oct 22, 2010

I'm trying to bind a List<String> to a DropDownList in a user control. I think I'm doing the right thing, but it seems that after my code executes the bindings are cleared. Here's the code for review!

User control:
<asp:DropDownList ID="subjectNameDropDown" runat="server"/>
<asp:DropDownList ID="yearLevelDropDown" runat="server"/>
Auto-generated designed code-behind:
public partial class NewSiteMetadataUserControl {
protected global::System.Web.UI.WebControls.DropDownList subjectNameDropDown;
protected global::System.Web.UI.WebControls.DropDownList yearLevelDropDown;
}
Code-behind:
public partial class NewSiteMetadataUserControl : UserControl
{
protected override void CreateChildControls()
{
subjectNameDropDown = new DropDownList();
yearLevelDropDown = new DropDownList();
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
EnsureChildControls();
// Attempt 1
List<String> subjectNames = GetSubjectValues();
foreach (var subjectName in subjectNames)
subjectNameDropDown.Items.Add(subjectName);
subjectNameDropDown.DataBind();
// Attempt 2
List<String> yearLevels = GetYearLevelValues();
yearLevelDropDown.DataSource = yearLevels;
yearLevelDropDown.DataBind();
}
}

Should this approach work? If it should, how can I debug what happens after the code executes?

View 2 Replies

DataSource Controls :: Removing Whitespace In String Not Working?

Jan 20, 2010

I am accumulating a string for a SQL IN clause, so the format needs to be WHERE var IN ('string1','string2','string3',etc)

The strings are coming from a multiline textbox where they are pasted in from the user (one per line).

For some reason, I always get a space right after the tick and before the value in every value after the first. For instance my DataReader is only returning one record because the input string turns out like this:

SELECT * FROM Table
WHERE ID IN ('12345',' 23456',' 34567')

Here is how I am processing the string, and I can't see why it is not taking that space out.

[Code]....

Even if I move the replace space (line 2) to the end of the code block, it still wont trim it out...

View 3 Replies

Web Forms :: Bind Multiple Query String Parameters From Database When Working With Eval

Aug 26, 2012

I have the following Repeater, I need to bind multiple querystring parameter inĀ  HREF

<li class="current">
<a href="house.aspx?H_name=all"></a>
<ul>
<asp:Repeater ID="rptMenu" runat="server">
<ItemTemplate>

[code]...

View 1 Replies

Forms Data Controls :: Passing Data From Selected Row In Repeater To A Query String?

Feb 12, 2010

I have the following ItemTemplate in Repeater1

[code]....

How do I insert the value of ListID into the query string?

View 6 Replies

Forms Data Controls :: Gridview TemplateField Show String According To Received Data?

Jul 26, 2010

What I want to do is to replace number with a name. So if in the Month Column it receives five "1" it changes those 5 "1" to JANUARY.

Is it possible? This is because unfortunately I can only arrange my months by number and not by their name, this because of my queries and tables format, so, I thought maybe I can tell the gridview to change the month number to their relative month name.

View 8 Replies

Forms Data Controls :: Select A Grid Row Based On Query String Data?

Jan 13, 2010

I need to know how can I select a gridview row based on a query string data. In my case, the query string will contain the id that exist in the Table related to that grid. Is there a way to do this from the code behind? In other words, if I click a link with that specific query string, can I open the page and tell my grid to select a specific row based on the table row id?

View 1 Replies

Forms Data Controls :: GridView Associate The Number To The Right String Data?

Dec 26, 2010

I have a table that shows datas from a SQL DB. Some of those datas is numeric ( 1,2,3) and in another table I got the name that represents each number.

ex:

1= Goalie
2= Defence

So I did a Class_filters, in which I associate the number to the right string data.

I was wondering how can I do that in GridView? Is it possible?

View 2 Replies

Forms Data Controls :: Conversion Failed When Converting Character String To Smalldatetime Data Type

Jun 29, 2010

I am getting an error when attempting to call a stored proc from my asp.net page.

e.Message = "Conversion failed when converting character string to smalldatetime data type."

The stored proc is being called by:

The asp.net code that is calling the stored proc is:

[Code]....

View 8 Replies

Forms Data Controls :: Data Formatting From String To Boolean?

May 4, 2010

I have the following code that works fine:

[code]....

View 7 Replies

Forms Data Controls :: Get Data Grid Values To String?

Apr 15, 2010

I need to get data from all rows which are selected (check box enabled). Can anyone give me hint? I am killing myself for last 10 houres with this.

What i need to say is that datasource is xml file

View 4 Replies

Forms Data Controls :: Formview Insert - Prefilled Data Not Working?

Jan 31, 2011

Two text boxes on a formview need to be prefilled with data (coming from session variables) on page load. The formview is in Insert mode by default. Is that the reason why it shows blank fields...

How do I get two fields filled in with data on page load.. the user will enter the rest of the fields and Click on Insert.

[Code]....

I put break points and saw that the data was coming in as expected...but when the page loads with formview, the text boxes do not show any data.

View 2 Replies

Forms Data Controls :: How To Get A Value For A Query String

Mar 31, 2011

How can I get the value of a hidden field as the value of a query string parameter?

[Code]....

View 2 Replies

Forms Data Controls :: FindControl To String?

Feb 9, 2011

this is probably very simple but I'm tearing my hair out!I'm using the FindControl method to try and grab the text in a textbox inside a DetailsView Template Field and display it on a label. Here is my code:

[Code]....

The word text has a squiggle underneath though and it causes an error as "System.Web.UI.Control' does not contain a definition for 'Text' and no extension method 'Text' accepting a first argument of type 'System.Web.UI.Control' could be found (are you missing a using directive or an assembly reference?)". I know the problem is that I'm treating this Control as a TextBox when it isn't, it's a Control. So how do I get from Control to TextBox so I can take the String and use it in code?

View 4 Replies

Forms Data Controls :: Get The String Value On The Gridview In C#.net?

Nov 24, 2010

im new in c#.net.. how will i get the string value on the gridview instead of its index.. this is my code:

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="mysubjectlist.aspx.cs" Inherits="_Default" Title="My Subject" %>

View 5 Replies

C# Replace String Not Working?

Oct 4, 2010

// Build email link
confirmLink = Master.siteDomain + "/newsLetter.aspx?action=confirm&e=" + emailAddress + "&code=" + verCode;
using (SqlCommand cmd = new SqlCommand("SELECT newRegEmailBody, newRegEmailSubj FROM tblSiteSettings WHERE (isActive = 1)", Master.cn))
{
SqlDataReader rdr = cmd.ExecuteReader();
if (rdr.Read())
{
emailBody = rdr[0].ToString();
emailSubj = rdr[1].ToString();
}
rdr.Close();
}
emailBody.Replace("[CONFIRMATION_LINK]", confirmLink);
emailer.sendEmail(emailAddress, Master.noReplyEmail, emailSubj, emailBody);

It all seems to work fine, except the body is still showing up with [CONFIRMATION_LINK] in the text,

View 4 Replies

Forms Data Controls :: Datagrid Validation Controls Partially Working?

Feb 15, 2010

the page can be seen here [URL]

the client side validation is working for the adding date and time, but there is no validation firing for the count and room fields, I think i have coded them all the same, see sample for time and room below, maybe somebody see's something i missed? the validation group fires when the add button is clicked. also if possible I would like to get validation messages to appear in a validationsummary control that I already have coded and that is working when using the edit/update the rows presented with existing data.

[code]....

View 4 Replies

Forms Data Controls :: Paging Not Working With Two Controls - Dropdownlist & Listview?

Oct 10, 2010

So I am using EW + Access database to create a page.

This page contains two controls. First control is Dropdownlist which databinds with second control Listview.

This listview has paging on becuse of multiple pages. If I don't use QueryStringField paging works but if I use QueryStringField paging doesn't work and it goes back to first option of Dropdownlist.

View 17 Replies

Forms Data Controls :: GridView Paging, Controls Not Working In Google Chrome Or Safari?

Mar 16, 2010

I have a gridview within an updatepanel which allows paging and has a linkbutton that when clicked shows a modalpopup for editing records. This works fine in IE, Firefox, and Opera but I do not get a postback in Chrome or Safari?? I have other linkbuttons on the page that are within updatepanels but are not within gridviews that are working fine. I have scowered the web but cannot find a solution.

[code]....

View 6 Replies







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