|
Nested means one inside another (when you are talking about a page), inherits means one derives from another (when you're usually talking about classes)
You cannot put a master page inside a master page. You can probably derive a master page class from another master page class. That means that if you have a master page with its corresponding code-behind class, you can create another master page and make it inherit from the first one.
1st Master page:
public partial class Master1: System.Web.UI.MasterPage
{
......
}
2nd Master page inherits from first one:
public partial class Master2 : Master2
{
....
}
I have never done that so I don't know if it works.
Talal
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
Dear All,
I have descriptions in DB for a news service Like These:
<BR>This is the Short Desc</BR>
I want to render this in a grid using ASP:DataGrid with Custom Template which is a Table. Therefore I have a code like this in my <ItemTemplate> lines:
<span class="style8">
<%# DataBinder.Eval(Container.DataItem, "ShortDesc")%>
</span>
But after rendering not only the text is not bold, but all the contents are also displayed. Therefore If there exists some other HTML Tags, All of them are not interpreted and will be displayed.
Since the Database content is just read only and I can't convert the Data, please let me know how I can show the text as was decorated in the editor.
Thanks,
Sassan
|
|
|
|
|
Use lable control
like <asp:Lable id="lbl" runat="server" text=' <%# DataBinder.Eval(Container.DataItem, "ShortDesc")%>' />
Best Regard
pathan
---------------------------------------------------
|
|
|
|
|
Thanks Pathan,
But first the code was like the one you mentioned and the problem observed:
<asp:label id="lblSC" runat="server" text="<%# DataBinder.Eval(Container.DataItem, "ShortDesc")%>">
When I check the DB Content , The < and > Characters are HTML Encoded, Therefore The text I see is what is in DB Not the < and > character to be layout.
Sassan
|
|
|
|
|
U can do that also in codebehind file using Server.HTMLEncode and Server.HTMLDecode method.
Best Regard
Pathan
---------------------------------------------------
|
|
|
|
|
Thanks.
The HTMLDecode worked.
Sassan
|
|
|
|
|
Thanks
Plz vote if u got solution
---------------------------------------------------
|
|
|
|
|
Hi i have some java scripts,
with that script i am testing one asp.net textbox value,
When the Html Button click in that time its checking the javascript function...,
But that script want to test based on the tab control,
Means after enter the value of that textbox, if cursor go to next tool in that time that script want to check the value...,
Similarly like the regularexpression validator...,
How to do that?,
Any possiblities are there?,
Advance thanks,
Regards,
Magi
|
|
|
|
|
Let me see if I understand what you want.
You want a Javascript code to check the value of a textbox when you click TAB and move to the next control. If that's so, you can use the validor and make it use client side script so it would check the textbox on the client side.
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
hi my problem is i have open rediffmailpro thr my site .in my site there is login page where userid and password if i will login so next rediffmailpro mailbox will open withoutopen rediffmailpro login page. so can this thish possible in asp.net 0r java script?
deepak chandra
|
|
|
|
|
Good Idea, but somewhat Impossible.
The Service Provider does not allow you to access the mailbox to your page.
There may be one possibility that you can use API for mailbox, if they provide.
Naresh Patel
|
|
|
|
|
i have tested with Firefox, Safari, Opera and IE7. I didn't see any problem with "overflow: auto; " CSS property.
I know you still have problem in using expression . I'm still looking for the solution.
For the time being, lets discuss about overflow only. I think that the code above works fine.
is it what you want or still having the problem in using that???
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
|
|
|
|
|
Hi Mr.Michael Sync..
Thank u soo much ur code is working . but header for that grid also moving in Mozilla in IE header is fixed , but Mozilla header is moving .. so please try for this . thank soo much
Reg
nantha
|
|
|
|
|
Hello
I have 2 Memory streams of 2 pdf files. Now i want to combine these 2 files into a single file ie 2 memory streams put together as single stream and print on the page using
HttpContext.Current.Response.BinaryWrite(combinedMemoryStream)
How to do it? Help needed urgently.
Thanks and Regards
Help in need is the help indeed
|
|
|
|
|
Hello,
I have used a Datalist to display the records...i want to give provision for users to edit their record...How can l implement this by using datalist????If any idea Please help me.....
Thanks in advance
Bijesh
|
|
|
|
|
Sample
------
<asp:DataList ID="dlGallery" OnEditCommand="dl_GalleryEdit" OnCancelCommand="dl_GalleryCancel" OnUpdateCommand="dl_GalleryUpdate" DataKeyField="ID" runat="server">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "username") %> - <%# DataBinder.Eval(Container.DataItem, "category") %>
<asp:LinkButton ID="lbGalleryEdit" Text="Edit" CssClass="changeLinks" CommandName="Edit" runat="server" /> |
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID="lblGalleryChgUser" Text="Username: " runat="Server" /><br />
<asp:TextBox ID="txtGalleryChgUser" Text='<%# DataBinder.Eval(Container.DataItem, "username") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:LinkButton ID="lbGalleryUpdate" Text="Update" CommandName="Update" CssClass="changeLinks" runat="server" /> |
<asp:LinkButton ID="lbGalleryCancel" Text="Cancel" CommandName="Cancel" CssClass="changeLinksLast" runat="server" />
</EditItemTemplate>
</asp:DataList>
protected void dl_GalleryEdit(Object s, DataListCommandEventArgs e) {
dlGallery.EditItemIndex = e.Item.ItemIndex;
//Update Code
bindData();
}
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Hello....
Please help How we can regonize the specified item want to change
by using this code
dlGallery.EditItemIndex = e.Item.ItemIndex;
our item template like this......
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "username") %> - <%# DataBinder.Eval(Container.DataItem, "category") %>
</ItemTemplate>
How we can get the value of item??????
Please help to solve my problem
thanks
Biju
|
|
|
|
|
What about EditTemplate?
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "username") %> - <%# DataBinder.Eval(Container.DataItem, "category") %>
<asp:LinkButton ID="lbGalleryEdit" Text="Edit" CssClass="changeLinks" CommandName="Edit" runat="server" /> |
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtUserName" Text='<%# DataBinder.Eval(Container.DataItem, "username") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="txtCategory" Text='<%# DataBinder.Eval(Container.DataItem, "category") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:LinkButton ID="lbGalleryUpdate" Text="Update" CommandName="Update" CssClass="changeLinks" runat="server" /> |
<asp:LinkButton ID="lbGalleryCancel" Text="Cancel" CommandName="Cancel" CssClass="changeLinksLast" runat="server" />
</EditItemTemplate>
Check-out this example
<a href = "http://authors.aspalliance.com/aspxtreme/webforms/controls/allowinguserstoedititemsindatalist.aspx" rel="nofollow">http://authors.aspalliance.com/aspxtreme/webforms/controls/allowinguserstoedititemsindatalist.aspx</a>
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Hello,
I set the code like this in html......
-----------------------------------------------------------------------------
<asp:datalist id="dlGallery" runat="server" OnCancelCommand="dlGallery_CancelCommand" OnUpdateCommand="dlGallery_UpdateCommand"
OnEditCommand="dlGallery_EditCommand" EditItemStyle-BackColor="lightgreen" AlternatingItemStyle-BackColor="Gainsboro"
HeaderStyle-BackColor="#aaaadd" Width="150px" Font-Size="8pt" Font-Name="Verdana" CellSpacing="0"
CellPadding="3" GridLines="Both" BorderWidth="1" BorderColor="black" DataKeyField="AD_TITLE">
<ItemTemplate>
<asp:LinkButton ID="lbGalleryEdit" Text="Edit" CssClass="changeLinks" CommandName="Edit" runat="server" />
<%# DataBinder.Eval(Container.DataItem, "AD_TITLE") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="Textbox1" Text='<%# DataBinder.Eval(Container.DataItem, "AD_TITLE") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox2" Text='<%# DataBinder.Eval(Container.DataItem, "AD_TYPE") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox3" Text='<%# DataBinder.Eval(Container.DataItem, "category_id") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox4" Text='<%# DataBinder.Eval(Container.DataItem, "AD_DESCRIPTION") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox5" Text='<%# DataBinder.Eval(Container.DataItem, "area") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox6" Text='<%# DataBinder.Eval(Container.DataItem, "unit") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox7" Text='<%# DataBinder.Eval(Container.DataItem, "PRICE") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox8" Text='<%# DataBinder.Eval(Container.DataItem, "WebUrl") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox9" Text='<%# DataBinder.Eval(Container.DataItem, "LOCATION") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox10" Text='<%# DataBinder.Eval(Container.DataItem, "plotname") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox11" Text='<%# DataBinder.Eval(Container.DataItem, "EMAIL_ID") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox12" Text='<%# DataBinder.Eval(Container.DataItem, "PHONENO") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:LinkButton ID="lbGalleryUpdate" Text="Update" CommandName="Update" CssClass="changeLinks" runat="server" />
<asp:LinkButton ID="lbGalleryCancel" Text="Cancel" CommandName="Cancel" CssClass="changeLinksLast"
runat="server" />
</EditItemTemplate>
</asp:datalist>
-----------------------------------------------------------------------------
and the C# code like this
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace Newclassified
{
/// <summary>
/// Summary description for samble11.
/// </summary>
public class Youradvts : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataList dlGallery;
protected System.Web.UI.WebControls.DataList DataList1;
DataTable dt;
SqlDataReader sdr;
public DataTable Cart;
protected System.Web.UI.WebControls.Label lblmem_id;
public DataView CartView;
connection constr=new connection();
private void Page_Load(object sender, System.EventArgs e)
{
if (Session["DL3_ShoppingCart"] == null)
{
Cart = new DataTable();
Cart.Columns.Add(new DataColumn("Title", typeof(string)));
Cart.Columns.Add(new DataColumn("Type", typeof(string)));
Cart.Columns.Add(new DataColumn("Category", typeof(string)));
Cart.Columns.Add(new DataColumn("Description", typeof(string)));
Cart.Columns.Add(new DataColumn("Area", typeof(string)));
Cart.Columns.Add(new DataColumn("Unit", typeof(string)));
Cart.Columns.Add(new DataColumn("Price", typeof(string)));
Cart.Columns.Add(new DataColumn("Web URL", typeof(string)));
Cart.Columns.Add(new DataColumn("Location", typeof(string)));
Cart.Columns.Add(new DataColumn("Name", typeof(string)));
Cart.Columns.Add(new DataColumn("Email ID", typeof(string)));
Cart.Columns.Add(new DataColumn("Phone No", typeof(string)));
Session["DL3_ShoppingCart"] = Cart;
// first load -- prepopulate with some data
for (int i=1; i<5; i++)
{
// dr[0] = ((int)((i%2)+1)).ToString();
// dr[1] = "Item " + i.ToString();
// dr[2] = ((double)(1.23 * (i+1))).ToString();
DataRow dr = Cart.NewRow();
dr[0] = "Title" + i.ToString();
dr[1] = "Type " + i.ToString();
dr[2] = "Category" + i.ToString();
dr[3] = "Description" + i.ToString();
dr[4] = "Area " + i.ToString();
dr[5] = "Unit" + i.ToString();
dr[6] = "Price" + i.ToString();
dr[7] = "WebURL" + i.ToString();
dr[8] = "Location"+i.ToString();
dr[9] = "Name"+i.ToString();
dr[10] = "Email ID " + i.ToString();
dr[11] = "Phone No"+i.ToString();
Cart.Rows.Add(dr);
}
}
else
Cart = (DataTable)Session["DL3_ShoppingCart"];
CartView = new DataView(Cart);
//CartView.Sort = "Item";
if (!IsPostBack)
BindList();
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dlGallery.SelectedIndexChanged += new System.EventHandler(this.dlGallery_SelectedIndexChanged);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
void BindList()
{
try
{
connection constr=new connection();
string ss=Session["uid"].ToString();
string mem_id;
string sstr1="select id from tbl_userreg where username='"+ss+"'";
sdr=constr.reader(sstr1);
while(sdr.Read())
{
mem_id=sdr["id"].ToString();
lblmem_id.Text=mem_id.ToString();
}
string str="select AD_TITLE,AD_TYPE,AD_DESCRIPTION,category_id,LOCATION,EMAIL_ID,PHONENO,DATE_POSTED from ads where member_id="+Convert.ToInt32(lblmem_id.Text.ToString())+"";
dt=new DataTable();
dt=constr.ExQselect(str);
if(dt.Rows[0].ItemArray[0].ToString()=="")
{
lblmem_id.Visible=true;
lblmem_id.Text="Please Add Your Advertisement";
}
dlGallery.DataSource=dt;
dlGallery.DataBind();
}
catch
{
lblmem_id.Visible=true;
lblmem_id.Text="Kindly Register YourSelf To ADVERTISE FREELY For 60 Days";
}
}
private void dlGallery_EditCommand(object sender, System.EventArgs e)
{
//dlGallery.EditItemIndex = e.AD_TITLE.ItemIndex;
BindList();
}
private void dlGallery_UpdateCommand(object sender, System.EventArgs e)
{
// string item = ((System.Web.UI.WebControls.Label)e.AD_TITLE.FindControl("Label1")).Text;
// string qty = ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text1")).Text;
string title = ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text1")).Text;
string type= ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text2")).Text;
string category = ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text3")).Text;
string description = ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text4")).Text;
string area = ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text5")).Text;
string unit= ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text6")).Text;
string price = ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text7")).Text;
string weburl = ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text8")).Text;
string location = ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text9")).Text;
string name= ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text10")).Text;
string emailid = ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text11")).Text;
string phoneno= ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text12")).Text;
// with a database, we'd use an update command. Since we're using an in-memory
// DataTable, we'll delete the old row and replace it with a new one
//remove old entry
//CartView.RowFilter = "Item='"+item+"'";
if (CartView.Count > 0) //item exists in cart
CartView.Delete(0);
CartView.RowFilter = "";
//add new entry
DataRow dr = Cart.NewRow();
dr[0] = title;
dr[1] = type;
dr[2] = category;
dr[3] = description;
dr[4] = area;
dr[5] = unit;
dr[6] = price;
dr[7] = weburl;
dr[8] = location;
dr[9] = name;
dr[10] = emailid;
dr[11] = phoneno;
Cart.Rows.Add(dr);
dlGallery.EditItemIndex = -1;
BindList();
}
private void dlGallery_CancelCommand(object sender, System.EventArgs e)
{
dlGallery.EditItemIndex = -1;
BindList();
}
-------------------------------------------------------------------------
But while running getting the error like this
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(159): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(161): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(169): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(168): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(160): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(158): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(167): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(166): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(165): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(162): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(164): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(163): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\index.aspx(2616): Could not find any attribute 'align' of element 'marquee'.
---------------------------------------------------------------------------
please help me to solve this problem.....
thanks
Bijesh
|
|
|
|
|
bijeshputhalath wrote: string title = ((System.Web.UI.WebControls.TextBox)e.AD_TITLE.FindControl("Text1")).Text;
You should remove "AD_TITLE ".
string title = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text1")).Text;
bijeshputhalath wrote: C:\Inetpub\wwwroot\approvedplotfinal\index.aspx(2616): Could not find any attribute 'align' of element 'marquee'.
Where do you set "marquee" in your code??
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Hello
while i removing AD_TITLE and try with your suggestion....But the following error comes
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(151): 'System.EventArgs' does not contain a definition for 'AD_TITLE'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(163): 'System.EventArgs' does not contain a definition for 'FindControl'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(171): 'System.EventArgs' does not contain a definition for 'FindControl'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(170): 'System.EventArgs' does not contain a definition for 'FindControl'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(162): 'System.EventArgs' does not contain a definition for 'FindControl'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(161): 'System.EventArgs' does not contain a definition for 'FindControl'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(169): 'System.EventArgs' does not contain a definition for 'FindControl'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(168): 'System.EventArgs' does not contain a definition for 'FindControl'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(167): 'System.EventArgs' does not contain a definition for 'FindControl'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(164): 'System.EventArgs' does not contain a definition for 'FindControl'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(166): 'System.EventArgs' does not contain a definition for 'FindControl'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(165): 'System.EventArgs' does not contain a definition for 'FindControl'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(160): 'System.EventArgs' does not contain a definition for 'FindControl'
-----------------------------------------------------------------------------
Now My code is below
---------------------------------
private void dlGallery_EditCommand(object sender, System.EventArgs e)
{
dlGallery.EditItemIndex = e.AD_TITLE.ItemIndex;
BindList();
}
private void dlGallery_updateCommand(object sender, System.EventArgs e)
{
// string item = ((System.Web.UI.WebControls.Label)e.FindControl("Label1")).Text;
// string qty = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text1")).Text;
string title = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text1")).Text;
string type= ((System.Web.UI.WebControls.TextBox)e.FindControl("Text2")).Text;
string category = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text3")).Text;
string description = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text4")).Text;
string area = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text5")).Text;
string unit= ((System.Web.UI.WebControls.TextBox)e.FindControl("Text6")).Text;
string price = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text7")).Text;
string weburl = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text8")).Text;
string location = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text9")).Text;
string name= ((System.Web.UI.WebControls.TextBox)e.FindControl("Text10")).Text;
string emailid = ((System.Web.UI.WebControls.TextBox)e.FindControl("Text11")).Text;
string phoneno= ((System.Web.UI.WebControls.TextBox)e.FindControl("Text12")).Text;
// with a database, we'd use an update command. Since we're using an in-memory
// DataTable, we'll delete the old row and replace it with a new one
//remove old entry
//CartView.RowFilter = "Item='"+item+"'";
if (CartView.Count > 0) //item exists in cart
CartView.Delete(0);
CartView.RowFilter = "";
//add new entry
DataRow dr = Cart.NewRow();
dr[0] = title;
dr[1] = type;
dr[2] = category;
dr[3] = description;
dr[4] = area;
dr[5] = unit;
dr[6] = price;
dr[7] = weburl;
dr[8] = location;
dr[9] = name;
dr[10] = emailid;
dr[11] = phoneno;
Cart.Rows.Add(dr);
dlGallery.EditItemIndex = -1;
BindList();
}
----------------------------------------------------------------------------
<asp:datalist id="dlGallery" runat="server" OnCancelCommand="dlGallery_cancelCommand" OnUpdateCommand="dlGallery_updateCommand"
OnEditCommand="dlGallery_EditCommand" EditItemStyle-BackColor="lightgreen" AlternatingItemStyle-BackColor="Gainsboro"
HeaderStyle-BackColor="#aaaadd" Width="150px" Font-Size="8pt" Font-Name="Verdana" CellSpacing="0"
CellPadding="3" GridLines="Both" BorderWidth="1" BorderColor="black" DataKeyField="AD_TITLE">
<ItemTemplate>
<asp:LinkButton ID="lbGalleryEdit" Text="Edit" CssClass="changeLinks" CommandName="Edit" runat="server" />
<%# DataBinder.Eval(Container.DataItem, "AD_TITLE") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="Textbox1" Text='<%# DataBinder.Eval(Container.DataItem, "AD_TITLE") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox2" Text='<%# DataBinder.Eval(Container.DataItem, "AD_TYPE") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox3" Text='<%# DataBinder.Eval(Container.DataItem, "category_id") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox4" Text='<%# DataBinder.Eval(Container.DataItem, "AD_DESCRIPTION") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox5" Text='<%# DataBinder.Eval(Container.DataItem, "area") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox6" Text='<%# DataBinder.Eval(Container.DataItem, "unit") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox7" Text='<%# DataBinder.Eval(Container.DataItem, "PRICE") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox8" Text='<%# DataBinder.Eval(Container.DataItem, "WebUrl") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox9" Text='<%# DataBinder.Eval(Container.DataItem, "LOCATION") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox10" Text='<%# DataBinder.Eval(Container.DataItem, "plotname") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox11" Text='<%# DataBinder.Eval(Container.DataItem, "EMAIL_ID") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox12" Text='<%# DataBinder.Eval(Container.DataItem, "PHONENO") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:LinkButton ID="lbGalleryUpdate" Text="Update" CommandName="Update" CssClass="changeLinks" runat="server" />
<asp:LinkButton ID="lbGalleryCancel" Text="Cancel" CommandName="Cancel" CssClass="changeLinksLast"
runat="server" />
</EditItemTemplate>
</asp:datalist>
----------------------------------------------------------
please help me to trace out ...
thanks
bijesh
|
|
|
|
|
Sorry.. my mistake ..
Try again with the following code.
e.Item.FindControl("")
If it is not still working, I wanna know a few thing and will make a sample download for you.
1. Are you using VS 2003 or 2005?
2. Are those column in DataList the bounded column or unbounded?
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Hello
Thank you for your reply....
1. Are you using VS 2003 or 2005? <b>Ans: vs2003</b>
2. Are those column in DataList the bounded column or unbounded? <b>Ans:Bounded</b>
i try it with <b> e.Item.FindControl("")</b>
But still the same error comes......
-------------------------------------------------------------------------
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(159): 'System.EventArgs' does not contain a definition for 'Item'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(163): 'System.EventArgs' does not contain a definition for 'Item'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(171): 'System.EventArgs' does not contain a definition for 'Item'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(170): 'System.EventArgs' does not contain a definition for 'Item'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(162): 'System.EventArgs' does not contain a definition for 'Item'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(161): 'System.EventArgs' does not contain a definition for 'Item'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(169): 'System.EventArgs' does not contain a definition for 'Item'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(168): 'System.EventArgs' does not contain a definition for 'Item'
C:\Inetpub\wwwroot\approvedplotfinal\classified\Youradvts.aspx.cs(167): 'System.EventArgs' does not contain a definition for 'Item'
----------------------------------------------------------------------------
<big>Then i hide(//give comment lines and try if the Datalist showing the items or not</big> <code><b> But the Error is like this ......What is my mistake, i cant recognize...???please help me to find it out.............</b></code>
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0122: 'Newclassified.Youradvts.dlGallery_cancelCommand(object, System.EventArgs)' is inaccessible due to its protection level
Source Error:
Line 7103: </tr>
Line 7104: </table>
Line 7105: <asp:datalist id="dlGallery" runat="server" OnCancelCommand="dlGallery_cancelCommand" OnUpdateCommand="dlGallery_updateCommand"
Line 7106: OnEditCommand="dlGallery_EditCommand" EditItemStyle-BackColor="lightgreen" AlternatingItemStyle-BackColor="Gainsboro"
Line 7107: HeaderStyle-BackColor="#aaaadd" Width="150px" Font-Size="8pt" Font-Name="Verdana" CellSpacing="0"
Source File: http://localhost/approvedplotfinal/classified/Youradvts.aspx Line: 7105
-----------------------------------------------------------------------------
<big><b>This is my HTML code</b></big>
<asp:datalist id=dlGallery DataKeyField="AD_TITLE" BorderColor="black" BorderWidth="1" GridLines="Both" CellPadding="3" CellSpacing="0" Font-Name="Verdana" Font-Size="8pt" Width="150px" HeaderStyle-BackColor="#aaaadd" AlternatingItemStyle-BackColor="Gainsboro" EditItemStyle-BackColor="lightgreen" OnEditCommand="dlGallery_EditCommand" OnUpdateCommand="dlGallery_updateCommand" OnCancelCommand="dlGallery_cancelCommand" runat="server">
<ItemTemplate>
<asp:LinkButton ID="lbGalleryEdit" Text="Edit" CssClass="changeLinks" CommandName="Edit" runat="server" />
<%# DataBinder.Eval(Container.DataItem, "AD_TITLE") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="Textbox1" Text='<%# DataBinder.Eval(Container.DataItem, "AD_TITLE") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox2" Text='<%# DataBinder.Eval(Container.DataItem, "AD_TYPE") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox3" Text='<%# DataBinder.Eval(Container.DataItem, "category_id") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox4" Text='<%# DataBinder.Eval(Container.DataItem, "AD_DESCRIPTION") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox5" Text='<%# DataBinder.Eval(Container.DataItem, "area") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox6" Text='<%# DataBinder.Eval(Container.DataItem, "unit") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox7" Text='<%# DataBinder.Eval(Container.DataItem, "PRICE") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox8" Text='<%# DataBinder.Eval(Container.DataItem, "WebUrl") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox9" Text='<%# DataBinder.Eval(Container.DataItem, "LOCATION") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox10" Text='<%# DataBinder.Eval(Container.DataItem, "plotname") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox11" Text='<%# DataBinder.Eval(Container.DataItem, "EMAIL_ID") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:TextBox ID="Textbox12" Text='<%# DataBinder.Eval(Container.DataItem, "PHONENO") %>' CssClass="txtBoxHalf" runat="server" /><br />
<asp:LinkButton ID="lbGalleryUpdate" Text="Update" CommandName="Update" CssClass="changeLinks" runat="server" />
<asp:LinkButton ID="lbGalleryCancel" Text="Cancel" CommandName="Cancel" CssClass="changeLinksLast"
runat="server" />
</EditItemTemplate>
</asp:datalist></TD>
----------------------------------------------------------------------------
This is my aspx.cs page
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace Newclassified
{
/// <summary>
/// Summary description for samble11.
/// </summary>
public class Youradvts : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataList dlGallery;
protected System.Web.UI.WebControls.DataList DataList1;
DataTable dt;
SqlDataReader sdr;
public DataTable Cart;
protected System.Web.UI.WebControls.Label lblmem_id;
public DataView CartView;
connection constr=new connection();
private void Page_Load(object sender, System.EventArgs e)
{
if (Session["DL3_ShoppingCart"] == null)
{
Cart = new DataTable();
Cart.Columns.Add(new DataColumn("AD_TITLE", typeof(string)));
Cart.Columns.Add(new DataColumn("Type", typeof(string)));
Cart.Columns.Add(new DataColumn("Category", typeof(string)));
Cart.Columns.Add(new DataColumn("Description", typeof(string)));
Cart.Columns.Add(new DataColumn("Area", typeof(string)));
Cart.Columns.Add(new DataColumn("Unit", typeof(string)));
Cart.Columns.Add(new DataColumn("Price", typeof(string)));
Cart.Columns.Add(new DataColumn("Web URL", typeof(string)));
Cart.Columns.Add(new DataColumn("Location", typeof(string)));
Cart.Columns.Add(new DataColumn("Name", typeof(string)));
Cart.Columns.Add(new DataColumn("Email ID", typeof(string)));
Cart.Columns.Add(new DataColumn("Phone No", typeof(string)));
Session["DL3_ShoppingCart"] = Cart;
// first load -- prepopulate with some data
for (int i=1; i<5; i++)
{
// dr[0] = ((int)((i%2)+1)).ToString();
// dr[1] = "Item " + i.ToString();
// dr[2] = ((double)(1.23 * (i+1))).ToString();
DataRow dr = Cart.NewRow();
dr[0] = "Title" + i.ToString();
dr[1] = "Type " + i.ToString();
dr[2] = "Category" + i.ToString();
dr[3] = "Description" + i.ToString();
dr[4] = "Area " + i.ToString();
dr[5] = "Unit" + i.ToString();
dr[6] = "Price" + i.ToString();
dr[7] = "WebURL" + i.ToString();
dr[8] = "Location"+i.ToString();
dr[9] = "Name"+i.ToString();
dr[10] = "Email ID " + i.ToString();
dr[11] = "Phone No"+i.ToString();
Cart.Rows.Add(dr);
}
}
else
Cart = (DataTable)Session["DL3_ShoppingCart"];
CartView = new DataView(Cart);
//CartView.Sort = "Item";
if (!IsPostBack)
BindList();
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dlGallery.SelectedIndexChanged += new System.EventHandler(this.dlGallery_SelectedIndexChanged);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
void BindList()
{
try
{
connection constr=new connection();
string ss=Session["uid"].ToString();
string mem_id;
string sstr1="select id from tbl_userreg where username='"+ss+"'";
sdr=constr.reader(sstr1);
while(sdr.Read())
{
mem_id=sdr["id"].ToString();
lblmem_id.Text=mem_id.ToString();
}
string str="select AD_TITLE,AD_TYPE,AD_DESCRIPTION,category_id,LOCATION,EMAIL_ID,PHONENO,DATE_POSTED from ads where member_id="+Convert.ToInt32(lblmem_id.Text.ToString())+"";
dt=new DataTable();
dt=constr.ExQselect(str);
if(dt.Rows[0].ItemArray[0].ToString()=="")
{
lblmem_id.Visible=true;
lblmem_id.Text="Please Add Your Advertisement";
}
dlGallery.DataSource=dt;
dlGallery.DataBind();
}
catch
{
lblmem_id.Visible=true;
lblmem_id.Text="Kindly Register YourSelf To ADVERTISE FREELY For 60 Days";
}
}
private void dlGallery_EditCommand(object sender, System.EventArgs e)
{
dlGallery.EditItemIndex = e.Item.ItemIndex;
BindList();
}
private void dlGallery_updateCommand(object sender, System.EventArgs e)
{
string item = ((System.Web.UI.WebControls.Label)e.Item.FindControl("Label1")).Text;
string qty = ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text1")).Text;
string title = ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text1")).Text;
string type= ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text2")).Text;
string category = ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text3")).Text;
string description = ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text4")).Text;
string area = ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text5")).Text;
string unit= ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text6")).Text;
string price = ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text7")).Text;
string weburl = ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text8")).Text;
string location = ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text9")).Text;
string name= ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text10")).Text;
string emailid = ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text11")).Text;
string phoneno= ((System.Web.UI.WebControls.TextBox)e.Item.FindControl("Text12")).Text;
// with a database, we'd use an update command. Since we're using an in-memory
// DataTable, we'll delete the old row and replace it with a new one
//remove old entry
//CartView.RowFilter = "Item='"+item+"'";
if (CartView.Count > 0) //item exists in cart
CartView.Delete(0);
CartView.RowFilter = "";
//add new entry
DataRow dr = Cart.NewRow();
dr[0] = title;
dr[1] = type;
dr[2] = category;
dr[3] = description;
dr[4] = area;
dr[5] = unit;
dr[6] = price;
dr[7] = weburl;
dr[8] = location;
dr[9] = name;
dr[10] = emailid;
dr[11] = phoneno;
Cart.Rows.Add(dr);
dlGallery.EditItemIndex = -1;
BindList();
}
private void dlGallery_cancelCommand(object sender, System.EventArgs e)
{
dlGallery.EditItemIndex = -1;
BindList();
}
-------------------------------------------------------------------------
Please help me to find out....
Thanks
Biju
|
|
|
|
|
|
hi all,
On the top 100 pages of a site I would like to add a list of pages that people who visited that page had also visited during their visit.
i will at the maximum post 5 links that was visited by the people.
Is there any way to get this kind of information?
Thanks in advance.
Regards
Anuradha
|
|
|
|
|