|
HimaBindu Vejella wrote: Any solutions to rectify it?
You simply copy the assembly Microsoft.Practices.EnterpriseLibrary.Data.dll to the temp folder of your web application:
C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/autosys_procurements_web/14145ce2/887b2a67/
|
|
|
|
|
Hi all,
How to bind the records from sql server tables and display into the HTML table control.
The data should be displayed in the HTML table with all features of datagrid(paging,edit and delete and go to page No).Simply with out using the datagrid.
Pls suggest me with some sample codings.
Thakx
Paul
Paul
|
|
|
|
|
Hi Paul,
The html table control does not support data binding like a data-bound control such as datagrid, datalist ..., so if you want to use the html table, you need to walk through the record collection of the datasource, then build each row (tr) for the table. Also you also need to manage all the built-in features of the datagrid control like paging, sorting ....it seems overhead to you. So I'm curious that why you don't just use the datagrid control.
|
|
|
|
|
Thnak you for your suggession.
But I am trying to do the datagrid functionalty to the html table.
THanks you again
By
Paul
Paul
|
|
|
|
|
Y don't u use DataGrid/List?
"Aim to go where U have never been B4 and Strive to achieve it"
http://groups.yahoo.com/subscribe/dotnetforfreshers
http://himabinduvejella.blogspot.com
|
|
|
|
|
I am tring the code to develop without datagrid/list?
Is it possible to do the same using HTMl Controls??
Paul
|
|
|
|
|
Hi..
I have a DataList that includes in its ItemTemplate an ImageButton which should use FieldNO(a DataItem field in the datasource ) as a QueryString to redirect() to another page:
Response.Redirect("default.aspx?FieldNO="+fieldNO+"&ProjectNO="+projectNO);
But i want this to happen only in a specific situation
(if(searchString!=null) is true) So the DataBinder.Eval() alone wont do what i want.So i used the following code in the method assigned to the OnCommand ImageButton attribute:
string fieldNO;
string argu=e.CommandArgument.ToString();
string[] argss=argu.Split(',');
if(searchString!=null)
{
DataRowView drv=(DataRowView)lProjects.Items[Convert.ToInt32(argss[1])].DataItem;
fieldNO=Convert.ToString(drv["FieldNO"]);
}
Where lProjects is the DataList And the Command Argument of the ImageButton is:
CommandArgument='<%#DataBinder.Eval(Container.DataItem,"ProjectNO")+","+Container.ItemIndex%>'
There is no relation between "ProjectNO" and the problem.The problem exists with the other field "FieldNO"
which i should get it from the datasource of the DataList in a specific condition.
But this code give me the error :
Object reference is not set to an instance.
Sorry if i couldnt explain my problem.
Could any one help?
|
|
|
|
|
+ You can use the ?: operator in the data binding expression to check if you should call the Eval method to populate the command argument.
+ You can wrap your sample code in a method, then simply call it in the data binding expression.
You can see the sample code from here[^].
|
|
|
|
|
These two ideas are exactly what i need.
May you give me code examples for them?...
|
|
|
|
|
You can find the examples from the provided link, and you can easily reuse it for your purpose:
+ Option 1:
<%# (strSearch is not null)? DataBinder.Eval(...):"" %>
+ Option 2:
<%# GetCommandArgument(Container.DataItem) %>
...
you can also define this method in the inline code.
Note: They all are the pseudo code.
|
|
|
|
|
Sorry,i didnt see the last statement in your previous message which was:
"You can see the sample code from here[^]."
Every thing is clear for me now.
Thank you very very much..I wont forget your help.
|
|
|
|
|
TheEagle wrote: Every thing is clear for me now.
Glad to hear you figured it out , good luck to you !
|
|
|
|
|
Hi..
after i build the code in my UserControl it gives me the error:
D:\MyWebApps\EProjects\UserControls\FieldProjectsList.ascx.cs(133): The type or namespace name 'DataBinder' could not be found (are you missing a using directive or an assembly reference?)
It seems to me that the UserControl is different from the WebForm in using the DataBinder class in the code behind page.
Could you help me in this problem?
|
|
|
|
|
Do you include the System.Web.UI namespace in the code-behind of the web user control?:
using System.Web.UI; In case you cannot figure out the problem, you might want to post your sample code in the user control.
|
|
|
|
|
Hi..Sorry for being too late.
After i added:
using System.Web.UI;
The build error disappeared but after i uploaded(updated) the project i got the error message:
Specified cast is not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Specified cast is not valid.
Source Error:
Line 12: <TR>
Line 13: <TD vAlign="middle" align="center">
Line 14: <asp:ImageButton id=ImageButton1 runat="server" OnCommand="gogof" ImageUrl='<%#"~/Epictures/"+DataBinder.Eval(Container.DataItem,"ProjectImage")%>' CommandArgument='<%#GenerateDataBinders(Container.DataItem,Container.ItemIndex)%>' CommandName="topf" BorderStyle="Solid" BorderColor="green">
Line 15: </asp:ImageButton></TD>
Line 16: </TR>
Source File: C:\Sites\Single25\nabeel1eagle\webroot\UserControls\FieldProjectsList.ascx Line: 14
The UserControl code:
namespace EProjects.UserControls
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
/// <summary>
/// Summary description for FieldProjectsList.
/// </summary>
public class FieldProjectsList : System.Web.UI.UserControl
{
protected System.Web.UI.WebControls.DataList lProjects;
private void Page_Load(object sender, System.EventArgs e)
{
string searchString=Request.QueryString["SearchString"];
string allWords=Request.QueryString["AllWords"];
string pageNumber=Request.QueryString["PageNumber"];
if(searchString!=null && searchString!="")
{
allWords=Request.QueryString["AllWords"];
pageNumber=Request.QueryString["PageNumber"];
lProjects.DataSource=catalog.SearchProject(searchString,allWords,pageNumber,System.Threading.Thread.CurrentThread.CurrentCulture.Name);
lProjects.DataBind();
}
else
{
BindData();
}
}
#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.lProjects.ItemDataBound += new System.Web.UI.WebControls.DataListItemEventHandler(this.lProjects_ItemDataBound);
this.lProjects.SelectedIndexChanged += new System.EventHandler(this.lProjects_SelectedIndexChanged);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
public void gogof(object s,CommandEventArgs e)
{string searchString=Request.QueryString["SearchString"];
// string allWords=Request.QueryString["AllWords"];
/* if(searchString!=null)
{
lProjects.DataSource=catalog.SearchProject(searchString,allWords);
lProjects.DataBind();
}
else
BindData();*/
//string fieldNO=Request.QueryString["FieldNO"];
string fieldNO=Request.QueryString["FieldNO"];
string fieldIndex=Request.QueryString["FieldIndex"];
string allWords=Request.QueryString["AllWords"];
string pageNumber=Request.QueryString["PageNumber"];
//string allWords=Request.QueryString["AllWords"];
/* if(searchString!=null)
{
lProjects.DataSource=catalog.SearchProject(searchString,allWords,pageNumber,System.Threading.Thread.CurrentThread.CurrentCulture.Name);
lProjects.DataBind();
}
else
BindData();*/
string argu=e.CommandArgument.ToString();
string[] argss=argu.Split(',');
string projectNO;
string projectIndex;
if(e.CommandName=="topf")
{
// Trace.Warn("ProjectProblem",projectNO);
if(searchString!=null && searchString!="")
{
Trace.Warn("FieldProblem",argu);
projectNO=argss[0];
fieldNO=argss[1];
Response.Redirect("default.aspx?FieldNO="+fieldNO+"&ProjectNO="+projectNO);
}
else
{
//Trace.Warn("ProjectNO=",Convert.ToString(argu.IndexOf("+")+1));
// Trace.Warn("IndexProblem=",Convert.ToString(argu.IndexOf("_")));
fieldNO=Request.QueryString["FieldNO"];
fieldIndex=Request.QueryString["FieldIndex"];
projectIndex=argss[1];
projectNO=argss[0];
Response.Redirect("default.aspx?FieldNO="+fieldNO+"&FieldIndex="+fieldIndex+"&ProjectNO="+projectNO+"&ProjectIndex="+projectIndex);
}
}
}
public void BindData()
{
string fieldNO=Request.QueryString["FieldNO"];
lProjects.DataSource=EProjects.AdministratorSite.AdminCatalog.GetFieldProjects(fieldNO,System.Threading.Thread.CurrentThread.CurrentCulture.Name);
lProjects.DataBind();
}
private void lProjects_ItemDataBound(object sender, System.Web.UI.WebControls.DataListItemEventArgs e)
{
}
private void lProjects_SelectedIndexChanged(object sender, System.EventArgs e)
{
}
public string GenerateDataBinders(object dataItem,int Index)
{string searchString=Request.QueryString["SearchString"];
string projectIndex;
string projectNO;
string fieldNO;
if(searchString!=null && searchString!="")
{
projectNO=(string)DataBinder.Eval(dataItem,"ProjectNO");
fieldNO=(string)DataBinder.Eval(dataItem,"FieldNO");
return projectNO+","+fieldNO;
}
else
{
Trace.Warn("PProjectNO=",Convert.ToString(Index));
projectNO=(string)DataBinder.Eval(dataItem,"ProjectNO");
projectIndex=Convert.ToString(Index);
return projectNO+","+projectIndex;
}
}
}
}
its HTML :
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="FieldProjectsList.ascx.cs" Inherits="EProjects.UserControls.FieldProjectsList" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<asp:datalist id="lProjects" Width="100%" RepeatColumns="2" runat="server">
<ItemTemplate>
<TABLE height="100%" cellPadding="0" width="100%">
<TR>
<TD align="center">
<asp:Label id="Label1" NAME="Label1" Runat="server" CssClass="labelstyle">
<%#DataBinder.Eval(Container.DataItem,"ProjectName")%>
</asp:Label><BR>
</TD>
</TR>
<TR>
<TD vAlign="middle" align="center">
<asp:ImageButton id=ImageButton1 runat="server" OnCommand="gogof" ImageUrl='<%#"~/Epictures/"+DataBinder.Eval(Container.DataItem,"ProjectImage")%>' CommandArgument='<%#GenerateDataBinders(Container.DataItem,Container.ItemIndex)%>' CommandName="topf" BorderStyle="Solid" BorderColor="green">
</asp:ImageButton></TD>
</TR>
<TR>
<TD align="center">
<asp:Label id="Label2" NAME="Label2" Runat="server">
<%#DataBinder.Eval(Container.DataItem,"ProjectDescription")%>
</asp:Label><BR>
</TD>
</TR>
</TABLE>
</ItemTemplate>
</asp:datalist>
I think that the problem in using the Container.ItemIndex.I have made it (int) and beforethis i tried making it object but the same error appeared.
You have helped me all the time thank you very much my teacher.
|
|
|
|
|
Hi..
May you help me in the problem that i mentioned in the previous message?
I couldnt determine what cause that error message..
Any advice could be helpful.
|
|
|
|
|
thanks in advance to all,i got a login from in my application.so i have to textboxes fro user name and password.i have required field validation control for both the text boxes.i have set control to validate and every thing that's working fine.so i got a button control to submit the information of the textboxes.when im clicking the button that validation working fine.my problem is i got another one link button in that page if i click that,that time also my validation controls get called and check for the data in the textboxes.i want to stop this .please help me.
with regards,
susa
|
|
|
|
|
+ If you are using the ASP.NET 2.0, you should check out the ValidationGroup[^] feature.
+ If you are using the ASP.NEt 1.x, you may think of implementing your own validator.
|
|
|
|
|
im using asp.net 1.x and im not having my own validation control and im using asp.net required field validators.
with regards,
susa
|
|
|
|
|
Set CausesValidation Property of the LinkButton to False
"Aim to go where U have never been B4 and Strive to achieve it"
http://groups.yahoo.com/subscribe/dotnetforfreshers
http://himabinduvejella.blogspot.com
|
|
|
|
|
hi thank u hima it's working now
hi to all
with regards,
susa
|
|
|
|
|
I have a delivery page (binded to an Orders.mdf) that looks something like this. A simple webform that only handle ONE KIND of product but has various weights.
[lblDate] = shows the date selected, receive user selected date from the Calendar control.
[txtDeliveryOrderNo] = clerk types in a Delivery Order No.
[ddlPort] = dropdownlist showing a list of sea port where goods are imported, databound to a SQL ports.mdf
[ddlCustomer] = dropdownlist showing a list of customer, by name. Place where goods are delivered. Databound to a SQL customers.mdf
[ddlTruck] = dropdownlist showing which truck does the delivery
[txtGrossWeight] = user enter the gross weight of the item here and then click on an "ADD ITEM" button control to store record. Can have multiple items.
[btnSave] = saves the order record to the orders.mdf.
[btnCancel] = cancel the order record.
Is there anyone who can gimme a rough idea of how this could be done? Or has anyone done it before? I need it in C# codes.
|
|
|
|
|
|
I have a Product Order page. A user can order many products. To simplify it, user can just type the word "beer" into a textbox and click on ADD button, cookies and click on ADD button again, socks and click on ADD button again into a database. So, a database will show:
UserID
UserName
OrderID
Product List (Beer, Cookies, Socks)
After the user decides on the list of things to buy. Then the user click on SAVE, to save that record (with multiple items) to another database.
Very much like ADD TO CART concept. Anyone can guide me with this? How should I go about it?
There are a lot of people who ended up doing things wrongly, even if they had the best of intentions at the beginning. Then again, there is no guarantee the words they said were conveyed as they originally were intended to be. That's because those on the receiving end only hear what they want to hear.
|
|
|
|
|
What I have is a web page, that allows you to select 1 of 12 possible options. When one of these 12 options are selected I want the web form that it loads to dynamically choose a flash movie file based on the selection.
Here is my code in HTML
<code><OBJECT id="Banner" style="Z-INDEX: 147; LEFT: 93px; POSITION: absolute; TOP: 158px" codeBase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" height="100" width="748" align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" VIEWASTEXT>
<PARAMNAME="_cx" VALUE="19791">
<PARAM NAME="_cy" VALUE="2646">
<PARAM NAME="FlashVars" VALUE="">
<PARAM NAME="Movie" VALUE="Banner.swf">
<PARAM NAME="Src" VALUE="Banner.swf">
<PARAM NAME="WMode" VALUE="Window">
<PARAM NAME="Play" VALUE="-1">
<PARAM NAME="Loop" VALUE="-1">
<PARAM NAME="Quality" VALUE="High">
<PARAM NAME="SAlign" VALUE="">
<PARAM NAME="Menu" VALUE="-1">
<PARAM NAME="Base" VALUE="">
<PARAM NAME="AllowScriptAccess" VALUE="sameDomain">
<PARAM NAME="Scale" VALUE="ShowAll">
<PARAM NAME="DeviceFont" VALUE="0">
<PARAM NAME="EmbedMovie" VALUE="0">
<PARAM NAME="BGColor" VALUE="FFFFFF">
<PARAM NAME="SWRemote" VALUE="">
<PARAM NAME="MovieData" VALUE="">
<PARAM NAME="SeamlessTabbing" VALUE="1">
<PARAM NAME="Profile" VALUE="0">
<PARAM NAME="ProfileAddress" VALUE="">
<PARAM NAME="ProfilePort" VALUE="0">
<embed src="Banner.swf" width="748" height="100" align="middle" />
</OBJECT></code>
***************************************************
Now as you can see..."<embed src="Banner.swf"....
.<PARAM NAME="Movie" VALUE="Banner.swf">..
...<PARAM NAME="Src" VALUE="Banner.swf">.
...<OBJECT id="Banner"....."
These are all pointing at "BANNER.SWF"....but in code I would like to dynamically change those tags to "BANNER2.SWF", "BANNER3.SWF"...etc etc based on the users choice.
I have tried using the "HtmlGenericControl" to try and change these during run time but not sucessfully.
Any help would be appreciated.
-- modified at 19:20 Sunday 23rd April, 2006
|
|
|
|