|
Respected,
I am having a idea about documentaion , About Project And it's
whole information like thier functionality,coding etc.So my Question is that
how we create documentation on my project.Give me site url or any hint.
Thanks...
|
|
|
|
|
You can use notepad if you like, but Word lets your format it better.
Your question makes no sense. You create documentation by writing it. You write comments in code, you can use various formats to comment methods which then can be used to create an auto generated, close to useless document, if your processes require it.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi!
I have a DB table product. product has foreign key ref to category as categoryId
category table has categoryId, categorycode and categoryname
now i have a product class and category class
when i display a datalist which is binded to a arraylist of product i also need to display category where this product belongs. now my question is, since product class wont have property of categoryid, code and name. should i be repeating those property in both product class and category class so i can have access of those properties?
|
|
|
|
|
The logical thing for any right minded person to do, would be to make the product class contain an instance of the category class.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
could you please provide me small correct snippet as to how it should look. I created one but not sure if its correct.
Public class Product
{
private string _productId;
...
private Category _category;
public Product()
{
this.ProductId = "";
this.Category.CategoryId = 0;
}
public Product(....parameter for product, string categoryId)
{
...
this.category.CategoryId = categoryId;
}
public Category category
{
get { return _category; }
set { _category = value; }
}
public ProductId
{
get { return _productId; }
set { _productId= value; }
}
modified on Monday, November 16, 2009 12:04 AM
|
|
|
|
|
Seems OK to me.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I thought so too. but do I need to pass this instance into class constructor?
public Product()
{
this.Category = null;
}
public Product(parameters..., Category c)
{
...
this.Category = c
}
...
...
public Category cat
{
get { return _category; }
set { _category = value; }
}
part of my BLL
public static class myBLL
{
public static List<Product> GetProducts(string CountryName, string AdCity, string AdSubCatType)
{
return myDAL.Instance.GetProducts(CountryName,AdCity,AdSubCatType);
}
part of my DAL
public List<Product> GetProductss(string CountryName, string AdCity, string AdSubCatType)
{
using (SqlConnection oConn = new SqlConnection(_connectionString)) {
string strSql = "spGetProductListList";
SqlCommand oCmd = new SqlCommand(strSql, oConn);
oCmd.CommandType = CommandType.StoredProcedure;
oCmd.Parameters.Add(new SqlParameter("@CountryName", SqlDbType.NVarChar, 50)).Value = CountryName;
oCmd.Parameters.Add(new SqlParameter("@AdCity", SqlDbType.NVarChar, 200)).Value = AdCity;
oCmd.Parameters.Add(new SqlParameter("@AdSubCatType", SqlDbType.NVarChar, 50)).Value = AdSubCatType;
oConn.Open();
string m = oCmd.ToString();
SqlDataReader oReader = oCmd.ExecuteReader();
List<Product> products= null;
products = GetProductCollectionFromReader(oReader);
oReader.Close();
return products;
}
}
protected List<Product> GetProductCollectionFromReader(IDataReader oReader)
{
List<Product> products = new List<Product>();
while( oReader.Read() )
products.Add(GetProductFromReader(oReader));
return products;
}
protected Product GetProductFromReader(IDataRecord oReader)
{
Product product = new Product();
product.ProductId = (int)oReader["ProductId"];
....
product.Category.CategoryName = (string)oReader["CategoryName"];
product.Category.CategoryCode = (string)oReader["CategoryCode"];
return product;
}
|
|
|
|
|
I get null reference exception.
|
|
|
|
|
Please describe how to do paging of the information of each page which includes 5 topics. Accordingly, there is coding of .vb for reference.
modified on Sunday, November 15, 2009 10:21 PM
|
|
|
|
|
A simple search of google will provide you the answer.
Also, please format your code with pre tags as described here[^] Most people will ignore posts that are not properly formatted.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Let's say I have in index.aspx.cs Page_load():
int id=1;
And I have a gridview populated by MS SQL, and I have the following selectcommand:
SelectCommand="SELECT * FROM [Filmes] WHERE [ID_Users]=' id '"
I need to use that variable that way.
Is it possible? What is the correct syntax? I tried many ways but cant do it. Really appreciate your help.
|
|
|
|
|
The syntax you are after is this:
SelectCommand="SELECT * FROM [Filmes] WHERE [ID_Users]= " & id
However, I would strongly recommend you use a stored procedure rather than SQL embedded in your code.
|
|
|
|
|
One step at the time
|
|
|
|
|
You have been given this advise before. Time to take heed. If you want to learn how to code, learn it right.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Maxdd 7 wrote: One step at the time
You say that and yet you post asking about every topic under the sun, without ever taking the time to properly learn anyting, or consider any of the good advice you are given
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Well,
Those are two different questions.
Maybe I should read some things first, that is one mistake and I assume.
Regarding the good advice I received, I consider them. I just no apply them for now, because I believe I should not try drive a truck, when I dont know how to drive a car.
|
|
|
|
|
That's the point you are missing, you are trying to taught how to ride a bike before you get near the car.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I know you are right I'm just trying to make you understand my point of view.
Until some days ago, I never coded a line of C# and used ASP.NET controls. I dont have a book (or e-book) or anyone I know who could teach me. The few I learn, was throught google, and even by google it could be difficult find the information I need. There are so many things of ASP.NET (I never imagined!), and then exists .NET 1.1, 2.0, 3.0 (...) VB.NET, older versions, near versions (...) Sometimes it could be difficult start coding in this conditions, because I dont know where to stand, where to look.
But ok, from now on, I will try to follow your advices, and just post questions (if necessary) about it.
My apologies for any incovenience.
|
|
|
|
|
Maxdd 7 wrote: Until some days ago, I never coded a line of C# and used ASP.NET controls.
Which means you're an idiot for trying ASP.NET at all. You need good C# first.
Maxdd 7 wrote: I dont have a book
If you can't buy one, then at least recognise what the right sequence is. I taught myself and I started with C++, then learned MFC. No-one told me that, it was common sense.
Maxdd 7 wrote: . The few I learn, was throught google, and even by google it could be difficult find the information I need.
99% of the questions asked here, it's trivial to get answers with google. The problem is you're trying to ask complex questions, before knowing the answers to the easy ones.
Maxdd 7 wrote: There are so many things of ASP.NET (I never imagined!), and then exists .NET 1.1, 2.0, 3.0 (...) VB.NET, older versions, near versions (...) Sometimes it could be difficult start coding in this conditions, because I dont know where to stand, where to look.
C#. Ignore VB.NET. Learn basic C#, preferably writing console apps. Then you could progress to web pages, perhaps. Don't even try to learn SQL before you know C# really well. Don't even think of ASP.NET before you learn the language that drives it.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Maxdd 7 wrote: I just no apply them for now, because I believe I should not try drive a truck, when I dont know how to drive a car.
Your problem is that you choose to drive the truck instead of starting with the damn car.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi!
I am trying to seperate my PL, BLL and DAL. I have managed successfully bind data to datalist via arraylist. Earlier, I was just doing direct calls to database for pagination using dataset and dataadapter. Since I am binding datalist via arraylist pagination seems bit complicated. below is my code. could someone please help?
public void ProductList()
{
List<product> products = new List<product>();
if (!Page.IsPostBack)
{
products = myBLL.Getproducts(Session["CountryName"], Session["City"], Session["AdType"]);
lblRecordCount.Text = products.Count.ToString();
products = null;
List<product> products = new List<product>();
}
sqlDataAdapt.Fill(dsProduct, Convert.ToInt32(lblCurrentIndex.Text), Convert.ToInt32(lblPageSize.Text), "product");
dlproductList.DataSource = dsproduct.Tables["product"].DefaultView;
dlproductList.DataBind();
sqlConn.Close();
ShowCounts();
}
public void ShowFirstPage(System.Object s, System.EventArgs e)
{
lblCurrentIndex.Text = "0";
productList();
}
public void ShowPreviousPage(System.Object s, System.EventArgs e)
{
lblCurrentIndex.Text = Convert.ToString(Convert.ToInt32(lblCurrentIndex.Text) - Convert.ToInt32(lblPageSize.Text));
if (Convert.ToInt32(lblCurrentIndex.Text) < 0)
{
lblCurrentIndex.Text = "0";
}
productList();
}
public void ShowNextPage(System.Object s, System.EventArgs e)
{
if ((int)Convert.ToInt32(lblCurrentIndex.Text) + Convert.ToInt32(lblPageSize.Text) < Convert.ToInt32(lblRecordCount.Text))
{
lblCurrentIndex.Text = Convert.ToString(Convert.ToInt32(lblCurrentIndex.Text) + Convert.ToInt32(lblPageSize.Text));
}
productList();
}
public void ShowLastPage(System.Object s, System.EventArgs e)
{
int intMod = 0;
intMod = Convert.ToInt32(lblRecordCount.Text) % Convert.ToInt32(lblPageSize.Text);
if (intMod > 0)
{
lblCurrentIndex.Text = Convert.ToString(Convert.ToInt32(lblRecordCount.Text) - intMod);
}
else
{
lblCurrentIndex.Text = Convert.ToString(Convert.ToInt32(lblRecordCount.Text) - Convert.ToInt32(lblPageSize.Text));
}
productList();
}
private void ShowCounts()
{
lblCounts.Text = "|Total Rows: <b>" + lblRecordCount.Text;
lblCounts.Text += "</b> | Page:<b> ";
lblCounts.Text += Convert.ToString(Convert.ToInt32(Convert.ToInt32(lblCurrentIndex.Text) / Convert.ToInt32(lblPageSize.Text)) + 1);
lblCounts.Text += "</b> of <b>";
if ((Convert.ToInt32(lblRecordCount.Text) % Convert.ToInt32(lblPageSize.Text)) > 0)
{
lblCounts.Text += Convert.ToString((Convert.ToInt32(lblRecordCount.Text) / Convert.ToInt32(lblPageSize.Text) + 1));
}
else
{
lblCounts.Text += Convert.ToString(Convert.ToInt32(lblRecordCount.Text) / Convert.ToInt32(lblPageSize.Text));
}
lblCounts.Text += "</b> |";
}
modified on Monday, November 16, 2009 12:05 AM
|
|
|
|
|
Dont you think using PagedDataSource can make life easier for you in this regard (Of course if you want to do this manually not using DataPager)
|
|
|
|
|
Hi! but i would like to show something like
Total count: X and Page 1 of 7
how do I get above done using pagedatasource class as i have only seen previous next button only
thank you for your help!
|
|
|
|
|
Yes you will get the CurrentPageIndex , CountofPages , Nos of items in a single page etc from the object.
Use
PageSize = No of rows each page will contain (You need to set this)
PageCount = No of Pages.
CurrentPageIndex = Page that is called for.
etc.
uglyeyes wrote: Total count: X and Page 1 of 7
Hey, if this is what you require, why do you need to build a custom html using PageDataSource , rather use DataPager control. It is easier to build these using <asp:DataPager
Check this :
http://msdn.microsoft.com/en-us/library/cc295263(Expression.30).aspx[^]
|
|
|
|
|
Please use the pre tags when posting code.
Most people here will ignore the post if it isn't properly formatted.
I know the language. I've read a book. - _Madmatt
|
|
|
|