|
I want to use TDD on a web base system written in C#.net 2.0. My web base is having some text boxes for user to input and save to the database using stored procedure. Those text boxes are also used for displaying value from the database. I have tried to search by google but no much detail can find. Hope anyone can give me a guild for this. Thanks a lot.
|
|
|
|
|
Hi, I've made a small web application with a ListBox which works well, but it is not very pretty with FireFox. The ListBox is populated automatically and its width changes with the contents. And when the list is empty, the width of the ListBox is about the width of the scrollbar... I've tried to fix its size, but I haven't been able to.
Anyone knows how I could do it?
Thanks!
|
|
|
|
|
Hi all,
i'm designing shopping cart.
but i have a problem by inserting item to the shoppoing cart.
when i add one item to cart,it added but when i add another item to cart with another ID the quantity of first item add(if i was added book1 and then i add another item for example book2 the quantity of book1 convert to 2 and book2 not be added in another row.
this is my code:
public void Insert(int Productid, double Price, int Quantity,string Productname, string Productimageurl)<br />
{<br />
int itemindex = itemindexofid(Productid);<br />
<br />
if (itemindex == -1)<br />
{<br />
cartitem newitem = new cartitem();<br />
newitem.Productname = Productname;<br />
newitem.Quantity = Quantity;<br />
newitem.Price = Price;<br />
newitem.Productimageurl = Productimageurl;<br />
items.Add(newitem);<br />
}<br />
else<br />
{<br />
items[itemindex].Quantity += 1;<br />
}<br />
lastupdate = DateTime.Now;<br />
}
and my function for itemindexofid:
private int itemindexofid(int Productid)<br />
{<br />
int index;<br />
foreach (cartitem item in items)<br />
{<br />
<br />
if (item.Productid == Productid)<br />
{<br />
return index=0;<br />
}<br />
index++;<br />
}<br />
return -1;<br />
}
i don't know where is problem.
thank you for your help.
Hoda
|
|
|
|
|
Saba02 wrote: if (itemindex == -1)
Then a new item is added, otherwise
Saba02 wrote: else
{
items[itemindex].Quantity += 1;
}
lastupdate = DateTime.Now;
}
The quantity increases.
So, I'd check with the debugger if itemindex is -1.
Saba02 wrote: return index=0;
Should this not be just 'return index' ???
Saba02 wrote: cartitem newitem = new cartitem();
newitem.Productname = Productname;
newitem.Quantity = Quantity;
newitem.Price = Price;
newitem.Productimageurl = Productimageurl;
items.Add(newitem);
Got it - you never set the productId in this code, so the search will always fail.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Dear Graus,
thank you for your responses.
i'm sorry for these questions.
i don't know how i defined 'return index=0' in this forum,
i was used this code:
private int itemindexofid(int Productid)<br />
{<br />
int index=0;<br />
foreach (cartitem item in items)<br />
{<br />
if (item.Productid == Productid)<br />
{<br />
return index ;<br />
}<br />
index++;<br />
}<br />
return -1;<br />
}
also now i correct my code with setting newitem.Productid = Productid;
but yet my problem exist.
Thank you,
Hoda
|
|
|
|
|
What happens if you step through your code in the debugger ? It still seems to me like this is where the problem is.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I am going to develop a site in English as well as in arabic,for english no problem but for arabic version there are few problems.
Problems List
1)Is i have to maintain two separate databases 1 for English and 1 for Arabic, or a single database can handle both English and Arabic, if yes how it can be done, by using UTF or something like that.
2)How can I Insert Arabic in sqlserver2005 database and get them as in Arabic.
Help me , and suggest me if anyone has done this before.
|
|
|
|
|
chanu007 wrote: 1)Is i have to maintain two separate databases 1 for English and 1 for Arabic, or a single database can handle both English and Arabic, if yes how it can be done, by using UTF or something like that.
I don't think so. You can keep a single database and separate with a flag value which indicates the language.
chanu007 wrote: 2)How can I Insert Arabic in sqlserver2005 database and get them as in Arabic.
use nvarchar which can store UTF characters.
|
|
|
|
|
So, if my arabic clients give their data in arabic how can i validate that what they have is correct or not as i dont' know arabic.
|
|
|
|
|
chanu007 wrote: if my arabic clients give their data in arabic how can i validate that what they have is correct or not
How are you validating it in English?
|
|
|
|
|
Hi,
Please any one explain me in detail how can I make use of "Remember me next time" option for Login Control.
Thanks.
|
|
|
|
|
use Cookies For That
Best Regards
-----------------
Abhijit Jana
"Success is Journey it's not a destination"
|
|
|
|
|
I have written some code.But its incompleate. Please explain me in detail how to go ahead from here.
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
if (this.Login1.RememberMeSet)
{
//Check if the browser support cookies
if ((Request.Browser.Cookies))
{
//Check if the cookie with name PBLOGIN exist on user's machine
if ((Request.Cookies["PBLOGIN"] == null))
{
//Create a cookie with expiry of 30 days
Response.Cookies["PBLOGIN"].Expires = DateTime.Now.AddDays(30);
//Write username to the cookie
Response.Cookies["PBLOGIN"].Values["UNAME"] = this.Login1.UserName.ToString();
//Write password to the cookie
Response.Cookies["PBLOGIN"].Values["UPASS"] = this.Login1.Password.ToString();
}
//If the cookie already exist then wirte the user name and password on the cookie
else
{
Response.Cookies["PBLOGIN"].Values["UNAME"] = this.Login1.UserName.ToString();
Response.Cookies["PBLOGIN"].Values["UPASS"] = this.Login1.Password.ToString();
}
}
}
}
|
|
|
|
|
function RememberMe()<br />
{<br />
var username = document.getElementById('txtUsername').value;<br />
var password = document.getElementById('txtPassword').value;<br />
<br />
var date = new Date();<br />
date.setTime( date.getTime() + (8640000000) );<br />
<br />
document.cookie = "Username=" + username + "; expires=" + date.toGMTString() + "; path=/";<br />
document.cookie = "Password=" + password + "; expires=" + date.toGMTString() + "; path=/";<br />
}<br />
<br />
' Read and set the username and password from the cookies.<br />
If IsNothing(Request.Cookies("Username")) = False Then txtUserName.Text = Request.Cookies("Username").Value<br />
If IsNothing(Request.Cookies("Password")) = False Then txtPassword.Text = Request.Cookies("Password").Value
Source :
http://www.geekpedia.com/tutorial81_Handling-cookies-in-ASP-.NET.html[^]
Best Regards
-----------------
Abhijit Jana
"Success is Journey it's not a destination"
|
|
|
|
|
|
i have a application in asp,in it there is a link for opening asp.net page.
it works fine in IE.it open aspx page.
but in case or firefox.
it not calling aspx page.
to calling aspx page from asp page,i write following code.
Response.Write("<form name=t id=t action=http://localhost:3823/SalesTracking/visualreport/Default.aspx method=post >")
Response.Write("</form>")
Response.Write("<script>t.submit();</script>")
what i have to do for firefox.so that i will work on firefox.
can any one help me.
thanks
|
|
|
|
|
currently i m using asp.net with C# (.net 2005, 2.0 framework)
DataColumnCollection tableCol = new DataColumnCollection[10] { "R", "Report"};
When i execute the above line, i get the error "Cannot implicitly convert type 'string' to 'System.Data.DataColumnCollection'"
help me! - KARAN
|
|
|
|
|
Karan_TN wrote: i get the error "Cannot implicitly convert type 'string' to 'System.Data.DataColumnCollection'"
The error message is self explanatory. It expects a System.Data.DataColumnCollection but your are supplying a string. You could do something like
DataColumnCollection[] tableCol = new DataColumnCollection[10] {new DataColumnCollection() , new DataColumnCollection() , ..... };
|
|
|
|
|
Thanks navaneeth.
kindly, Can u provide me and example plzzzzz
|
|
|
|
|
hi,
i have one iframe in my web page. that iframe was not resized when i load a page in firefox. plz help this problem to solve it.
the code of resize the iframe for firefox is
if(navigator.userAgent.indexOf("Firefox") != -1)
{
if (obj.contentDocument || obj.contentDocument.body.offsetHeight)
var sh = obj.contentDocument.body.offsetHeight+FFextraHeight;
}
Bye
Neels
|
|
|
|
|
Hi all,
From past 5-6 years i have bben taught that u should have a return statement in your function definition if ur code returns a value, but to my astonishment the following code does return a value, but threre is no return statement at all...
Public Function GetMaximumId(ByRef ColName As String, ByRef con As SqlClient.SqlConnection, ByRef TabName As String) As Long<br />
Dim SQL As String<br />
Dim dr As SqlClient.SqlDataReader<br />
SQL = "select isnull(max(substring(" & ColName & ",5,10)),'0') from " & TabName<br />
<br />
Dim cmd As New SqlClient.SqlCommand(SQL, con)<br />
dr = cmd.ExecuteReader<br />
dr.Read()<br />
If IsDBNull(dr.GetValue(0)) = True Then<br />
GetMaximumId = 1<br />
Else<br />
GetMaximumId = dr.GetValue(0) + 1<br />
End If<br />
cmd.Dispose()<br />
dr.Close()<br />
End Function
How does this thing work?
When you fail to plan, you are planning to fail.
|
|
|
|
|
Its VB, what do you expect? The old VB way of returning a value (before it had the return statement) was to treat the function name as a variable. Assigning that variable a value returned that value....hence:
Public Function GetMaximumId(...)<br />
...<br />
If IsDBNull(dr.GetValue(0)) = True Then<br />
GetMaximumId = 1<br />
Else<br />
GetMaximumId = dr.GetValue(0) + 1<br />
End If<br />
...<br />
|
|
|
|
|
OH... this VB s****.I has screwed up all my oops concepts.C# is far better than VB, a good structured prog language.
Thank you for ur kind help...
When you fail to plan, you are planning to fail.
|
|
|
|
|
Hi,
I have craated an interface for generating the rdl file through c# (User will select some fields for group and some for details and report will be generated accordingly). I am generating the XML for the rdl according to the schema. And the report is running fine in my local system where i am using sqlexpress but is not working in production. The problem is coming with the datasource as follows.
An error has occurred during report processing.
Cannot create a connection to data source 'SOP'.
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection
I am using Integrated Authentication, below is the datasource code generated by c#
<DataSource Name="SOP">
<ConnectionProperties>
<IntegratedSecurity>true</IntegratedSecurity>
<ConnectString>Data Source=SIGMASQL;Initial Catalog=SOP</ConnectString>
<DataProvider>SQL</DataProvider>
</ConnectionProperties>
<rd:DataSourceID>36a274d3-f283-4ac9-9f26-401ddf14f733</rd:DataSourceID>
</DataSource>
When i am pasting the RDL xml to my BI project's Report it is giving preview properly, but after deployment it is not coming.
I have tried with SQL Authentication also by removing the IntegratedSqcurity element and changin g the connection string to add "sa" userid, but still it doesn't run and gives the same error and if i refresh the report with the refresh button of report viewer, it shows some Wrong String Format error.
When i am editing the dataset in the report designer(BI Project), the connection string is not storing password and username info in the xml of the rdl, i read somewhere that it stores these values in VS2005 and reporting service database with some encryption and don't keep in the xml. So it is seeming to me that i am not sending these credentials to reporting service while deployment through my c# code. Below is my deployment code
byte[] byteRDL;System.Text.UTF8Encoding encoder = new UTF8Encoding();
byteRDL = encoder.GetBytes(reportDefination);
Property[] rsProperty = new Property[10];
//Property property = new Property();
Warning[] warnings;
warnings = rs.CreateReport(reportName, "/QuoteReports", true, byteRDL, null);
But i have no idea why it is not even running with Windows Authentication also.
I am in big trouble guys. Pls help. I have to show it to my client..
Tarun Ghosh
Kolkata-India
|
|
|
|
|
I am working with MOSS 2007. Problem scenario as follows
1.We have developed one portal by using SharePoint server 2007 and this portal has been enabled for intranet and extranet environment.
2. Authentication used for this particular portal is Windows NTLM authentication.
3. User who is logging from extranet (From internet i.e. out side domain) will get initial authentication prompt, once user provides his credentials he can able to login in to the portal and he can access all pages around the portal except document link from document library with out any extra authentication prompt.
4. But if user is accessing any document from any document library, system is asking authentication and this is for every time and for every document library.
5. As per customer requirement we need to stop this unwanted authentication prompt.
Please let me know any solution available ASAP.
|
|
|
|