|
I have a DataView control and would like to display the first and last name of the employee using the Northwind db. I have the following which works fine...but I'd like to use the first and last name.
<ItemTemplate>
<%#Eval("Customer.CompanyName")%>;
</ItemTemplate>;
|
|
|
|
|
The easiest way is to concatenate the fields in sql 'firstname + lastName as Name'
A gridview has onitemdatabound event where you can set the values in code. But I am not familiar with a dataview.
I didn't get any requirements for the signature
|
|
|
|
|
Multiple cross posting.
Blog link to be reinstated at a later date.
|
|
|
|
|
As already mentioned, please do not cross post. It is annoying seeing your same question in multiple forums. Pick the appropriate forum for your question and let it be
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
<%#Eval("Customer.CompanyName") & " " & Eval("Other field") %>;
Alexei Rodriguez
|
|
|
|
|
|
After a user successfully inserts a new record in the "DetailView" control, I want to redirect them to a new page. Is the best method of doing this as follows:
protected void DetailsView1_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
{
Response.Redirect("Part2.aspx");
}
|
|
|
|
|
Yes. If you want to stop processing code then do Response.Redirect("Part2.aspx", true); otherwise leave it.
I didn't get any requirements for the signature
|
|
|
|
|
...
Blog link to be reinstated at a later date.
|
|
|
|
|
Yes, Response.Redirect will work, and do not cross post. This question is in the correct forum, the same question being asked in the other forums is annoying.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
As on this page when you try to leave without submitting you are given a warning. I no this is done on pageunload with javascript but I'm pretty sure there is a tutorial on this somewhere but I'm having trouble finding it.
Anyone know off hand where a tutorial is to warn the user when they are trying to leave a page.
I didn't get any requirements for the signature
|
|
|
|
|
Nevermind, I figured it out by viewing the source on this page.
Thanks Code Project!
I didn't get any requirements for the signature
|
|
|
|
|
Hi;
I have a grid with AllowPaging = "True" I try to export my grid to excel the problem is that I have to export each page of my grid to excel.
I need a solution that exporte data from the entire grid ?
thank you .
|
|
|
|
|
Hi friends,
How should i add rich text box control in web applications?
Thanks in advance
Regards,
Venkat
|
|
|
|
|
if by rich text box you mean an editor, then check out FCKeditor - http://www.fckeditor.net/[^]
it has a component for ASP.NET so it's quite simple to use it and plus it is very powerful.
Andrei
|
|
|
|
|
I dont think so there is any control available. you can use javascript edtor for that. there are many such control available in codeproject it self.
cheers,
Abhijit
|
|
|
|
|
How can i get that controls?
Can u give me the link?
|
|
|
|
|
|
Hello i have one serious problem
Product name is : T. Owens Action Figure" (It has a double quote at last)
when the product is browsed through the web the page is not rendered correctly because of the presence of the double quotes in the Product name.
and the product name is binded to the control at runtime.
i want the product should be rendered correctly even the product name contains (") quotes.
(this is the code written in the .aspx page.)
"< ahref ="javascript:LoadLargeImage( '<%=Ext_Product.ItemAttributes.Image[0].URL %>','<%=CommonHelper.MakePageTitle(Ext_Product.ItemName )%>')">Zoom "
This is the code captured after the page is renderd(See Below)
because of the double quotes the script is not rendered .
<a href ="javascript:LoadLargeImage( 'http://localhost/DallasStore/CatalogImages/18-41-Large_Image.jpeg','T. Owens Action Figure - Dallas Cowboys""')">Zoom</a>
How to resolve this issue..Plz help
|
|
|
|
|
In Both of your post nothing is understandable . can you please confirm your query ?
Member 3128874 wrote: Subject:Hi all i have a seriou problem plz help me
It should not be the subject. Always try to give proper subject that every body can understand your main query objective from Subject itself.
cheers,
Abhijit
|
|
|
|
|
Member 3128874 wrote: one serious problem
You actually have several serious problems.
1. You posted the same question twice within a very short time
2. Your subject is meaningless
3. It appears the shift and various other keys don't work on your keyboard. There is no additional charge per character here on CP, so PLZ USE ALL UR KEYS pROPErly
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hello i have one serious problem
Product name is : T. Owens Action Figure" (It has a double quote at last)
when the product is browsed through the web the page is not rendered correctly because of the presence of the double quotes in the Product name.
and the product name is binded to the control at runtime.
i want the product should be rendered correctly even the product name contains (") quotes.
(this is the code written in the .aspx page.)
Zoom
This is the code captured after the page is renderd(See Below)
because of the double quotes the script is not rendered .
<a href ="javascript:LoadLargeImage( 'http://localhost/DallasStore/CatalogImages/18-41-Large_Image.jpeg','T. Owens Action Figure - Dallas Cowboys""')">Zoom</a>
How to resolve this issue..Plz help
|
|
|
|
|
No one here cares if it is urgent.
Blog link to be reinstated at a later date.
|
|
|
|
|
Hi all,
I have a simple page on which I've place a gridview which is bound to a generic List that contains ShoppingCartItem objects.
the code for my aspx file looks like this:
]]>
<asp:content id="Content3" contentplaceholderid="ArticleContent" runat="server" xmlns:asp="#unknown">
<asp:label id="lblShoppingCartStatus" runat="server" text="">
<asp:gridview onrowediting="gridCart_RowEditing">
OnRowCancelingEdit="gridCart_RowCancelingEdit"
OnRowUpdating="gridCart_RowUpdating"
OnRowCommand="OnRowCommand"
OnRowUpdated="gridCart_RowUpdated"
ID="gridCart" runat="server"
AutoGenerateColumns="false" EnableViewState="true">
<columns> <asp:boundfield readonly="true" datafield="Description" headertext="Product">
HtmlEncode="False">
<itemstyle width="300px">
<asp:boundfield readonly="true" datafield="Price" headertext="Price">
HtmlEncode="False">
<itemstyle width="100px">
<asp:boundfield readonly="false" datafield="Quantity" headertext="Quantity">
HtmlEncode="False">
<itemstyle width="100px">
<asp:commandfield buttontype="Link" edittext="Modify" showeditbutton="true" causesvalidation="false">
My code behind code looks like this:
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
namespace Customer
{
public partial class PrimeShopCheckout : System.Web.UI.Page
{
private List<shoppingcartitem> ShoppingCartItems
{
get
{
if (ViewState["shoppingCartItems"] != null)
{
return (List<shoppingcartitem>)ViewState["shoppingCartItems"];
}
return new List<shoppingcartitem>();
}
set
{
ViewState["shoppingCartItems"] = value;
}
}
private void BindGrid()
{
gridCart.DataSource = ShoppingCartItems;
gridCart.DataBind();
}
protected void gridCart_RowEditing(object sender, GridViewEditEventArgs e)
{
gridCart.EditIndex = e.NewEditIndex;
BindGrid();
}
protected void gridCart_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
gridCart.EditIndex = -1;
BindGrid();
}
protected void gridCart_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
// get the information
int rowIndex = e.RowIndex;
var a = gridCart.Rows.Count;
}
protected void gridCart_RowUpdated(object sender, GridViewUpdatedEventArgs e)
{
e.KeepInEditMode = false;
}
protected void OnRowCommand(object sender, GridViewCommandEventArgs e)
{
var aaa = gridCart.Rows.Count;
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Hashtable shoppingCart = (Hashtable)WebProfile.Current.ShoppingCart;
List<shoppingcartitem> shoppingCartItems = new List<shoppingcartitem>();
IDictionaryEnumerator enumerator = shoppingCart.GetEnumerator();
while (enumerator.MoveNext())
{
var item = new ShoppingCartItem();
Product product = (Product)enumerator.Key;
int quantity = (int)enumerator.Value;
item.Description = product.Description;
item.Price = product.Price;
item.Quantity = quantity;
shoppingCartItems.Add(item);
}
ShoppingCartItems = shoppingCartItems;
gridCart.DataSource = ShoppingCartItems;
gridCart.DataBind();
}
}
}
[Serializable]
public class ShoppingCartItem
{
public string Description { get; set; }
public decimal Price { get; set; }
public int Quantity { get; set; }
}
}
The problem is that when I click the Update button to change the number of items for a specific product, in the RowUpdating event handler I get the number of rows as 0!!!!
I've read plenty of docs on the gridview, searched google for answers to my problem, saw implementations for the functionality I use .... according to what I read so far, everything should work fine. But it's not!
Can anyone let me know why the number of rows is zero in the row updating event?
Where am I losing the data in the gridview?
I need help with this as I am completly stuck at this moment - I don't have any clue what else to try....
Thanks in advance!
Andrei
|
|
|
|
|
Hello Friends,
I want to validate textbox of a GridView using the RequiredFieldValidator
So for it i'm using the following code but it's not working fine. As i click on the update button it show the error for a while but do a postback but it should not do any postback and should validate as well.......
Here i'm giving a bit of code below Please let me know the problem i'm creating
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CssClass="ElearningDataGridBody"
DataKeyNames="ID" OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowEditing="GridView1_RowEditing"
OnRowUpdating="GridView1_RowUpdating" Width="100%" OnRowDeleting="GridView1_RowDeleting">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:TemplateField HeaderText="Category Name">
<EditItemTemplate>
<asp:TextBox ID="TextBox_CategoryName" runat="server" Text='<%# Bind("CategoryName") %>'></asp:TextBox>
<asp:RequiredFieldValidator ID="required_CategoryName" ErrorMessage="Please Enter Category Name Edit" ForeColor="red" ControlToValidate="TextBox_CategoryName" runat="server">*</asp:RequiredFieldValidator>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("CategoryName") %>'></asp:Label>
</ItemTemplate>
|
|
|
|