man
i can't use crystal reports, i need it in C#.
man
i can't use crystal reports, i need it in C#.
Hi
I have a windows application that prints a record in a given page size.
I looked all over but i could not see how did it set the page size.
and now requirement is to print the paper size in legal paper size of 18.5" by 14".
How can i set the printing process to print in this paper size.
I have not done this kind of job before so i am finding it quite difficult.
Searching internet was not much help
Please help
Hi everybody
I have been developing windows client application in .net framework 3.5. The system is supposed to copy the remote mysqldb and restore my local mysqldb with all the schema and data withing remote schema to my local mysqldb with the same database name.
Well i found a solution to this using a mysqldump command and executing it from .net by writing all the necessary command in a bat file and executing the bat file by invoking from .net.
But i was looking for a better solution.
The way we make a sqlserver db backup and restore usig SqlServer.Smo package in .net
I there any way to make a database backup and restore using mysql.data.client. or just copy my remote mysql database to my local mysql database. all using mysql.data.client.
Thanks
thanks sknake
What is the difference between following declarations:
WebUserService.Service.IUserService userService = new WebUserService.Service.UserService();
WebUserService.Service.UserService userService = new WebUserService.Service.UserService();
I want to know the difference in usage and the the one that is most efficient in terms of programming in C#.
Thank you guys, you have been real helpful
If it is true then i think i am having the problem is that client doesn't have the corresponding version of .net framework installed on his computer, that is why he is not able to run the application on his computer.
what do you say?
Thank you guys, you have been really helpful.
I was thinking the same.
But one thing is for sure that to run applications developed in .net correspondig versions of .net framework must be installed on client computer.
It is true, isn't it?
how can we solve the problem of 32/64 bit platform and if they if have different cpu as X86 or x64,
Hi
I have developed application in .net framework 3.5 WPF.
Well, you know WPF also requires .net framwork 3.5 SP1.
Now it's works fine on my computer.
But i need to ship it the client.
What will be the software requirements at the client side to run my application.
Is it possible that i just pack everything in a single exe file or a folder and client don't have to install anything else except to double click the exe file and start using it.
Well the problem occured when i developed the application in WPF and ship it to client but at client computer there was .net framework 3.5 installed along with .net framework 3.5 service pack one.
So i suggested him to install both of them and then he can use the application i developed.
Well, you understand that it's complicated for client to handle these technical issues and moreover .net framework 3.5 is large and along with it they also had to install .net framework 3.5 sp1.
Well, i don't think this is a best idea, there must be something else easier and more compact.
Thanks
Hi
All the coders out there. I need a suggestion.
I have windows xp installed on my computer and i need to develop application for windows vista.
I would prefer to use .net framework 2.0 and visual studio 2005.
Instead of .net framework 3.5 and visual studio 2008.
Well, selection between .net framework is not a problem. It's ok if i could just use any of them. But i need to develop it on windows xp machine and would expect to implement it on windows vista or higher version of windows.
How can i do this?
Please help
Thanks
There is myWebBrowser.NavigateToString method in which we can pass the string that consist of a web form and a javascript function which submits the form when it loads, for example the code is given below:
string documentText = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" +
"<html xmlns=\"http://www.w3.org/1999/xhtml\">" +
"<head>" +
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />" +
"<title>Untitled Document</title>" +
"<script type=\"text/javascript\">" +
"function SubmitForm()" +
"{" +
" document.forms[0].submit();" +
"}" +
"</script>" +
"</head>" +
"<body onload=\"SubmitForm()\">" +
"<form id=\"form1\" name=\"form1\" method=\"post\" action=\"http://www.mywebsite.com/index.php\">" +
"<h1>Loading....</h1>" +
"<input type=\"hidden\" id=\"txtUsername\" name=\"txtUsername\" value=\"" + txtUserName.Text + "\" />" +
"<input type=\"hidden\" id=\"txtPassword\" name=\"txtPassword\" value=\"" + txtPassword.Password + "\" />" +
"<input type=\"hidden\" value=\"Sign In\" />" +
"</form>" +
"</body>" +
"</html>";
myWebBrowser.NavigateToString(documentText);
I found the solution.
Thank you
I have a php website which i want to run in C# wpf webbrowser control.
I have a validated a username and password for the site by connecting to it's database using .net.
Now i want the functionality to take username and password and submit the post form to php page that will validate the username and password again(of course it is already validated) or not validate and send the user to the page that it needs to redirect. and i want that page to be seen in my webbrowser control.
How do i do this.
thank you sknake and ddanbe, for your replies.
using NLST gives the names only
the problem is solved.
Hi
I am developing FTP Clinet application that downloads files from the specified server
i sent the LIST command and server returned a list of file names in following order:
-rw-r--r-- 1 devubas devubas 24 Sep 5 2008 .bash_logout
now the problem is how do i extract the filename fom above string for example just the .bash_logout.
Is there any way to just get the filename from FTP server by sending this command combined with other parameters.
Please help
You should some books on java programming.
For the beginner refer to this location: java looping statements
Let me give you some tips about programming:
Whenever you are in problem or want to learn something, search the topic on net. I mean search in google. You will find lots of search results. Select the one and start learning.
for example go to google and type the search keyword: java loop statements. It will give you lots of results. Go through the short descriptions or search results page ,select the one that you think is the one that you want and follow it.
You should enter appropriate keywords in google to get the required results.
Don't panic, keep calm read the articles carefully, and there you go your problem is solved.
If you need further help. Just ask me or any other programmer on daniweb.
Thanks
good luck.
And do you mean looping through the resultset returned that is returned from the database or looping in sql statement.
I copied and run your code on my computer. It works fine on my computer may be your database doesn't consist of data which is extracted on the basis of filter from dropdownlist.
what exactly are you referring to. You already got your gridview filled with the record's based on the filter value from the dropdownlist.
Are you looking for looping in sql or in c#.
Sorry man, i am confused.
Above code is very simple. If this is not the thing you want. Cheer up man, just let me know. I have other options as well.
If you want to display the item in gridview with the item selected in dropdownlist on selected index change of dropdownlist, then here is your code to do this.:)
First declare a dropdownlist and Gridview in the aspx web page like shown below:
<div>
<asp:DropDownList ID="ddItems" runat="server" Width="100px" OnSelectedIndexChanged="ddItems_SelectedIndexChanged" AutoPostBack="true">
<asp:ListItem Text="10" Value="10"></asp:ListItem>
<asp:ListItem Text="11" Value="11"></asp:ListItem>
<asp:ListItem Text="12" Value="12"></asp:ListItem>
<asp:ListItem Text="13" Value="13"></asp:ListItem>
</asp:DropDownList>
<asp:GridView ID="GridView1" runat="server"></asp:GridView>
</div>
Then for initial loading of the gridview and to load gridview with the item selected in the dropdownlist on selected index change of dropdownlist write the following code in the code-behind:
//Declare ArrayList object al in the class
ArrayList al;
protected void Page_Load(object sender, EventArgs e)
{
//For initial loading of gridview
al = new ArrayList();
al.Add("test");
al.Add("test1");
GridView1.DataSource = al;
GridView1.DataBind();
}
protected void ddItems_SelectedIndexChanged(object sender, EventArgs e)
{
//to load the gridview with the item selected in gridview
al.Clear();
al.Add(ddItems.SelectedValue);
GridView1.DataSource = al;
GridView1.DataBind();
}
I think this will solve your problem. If not the contact me anytime.
If this solved your problem, please mark it solved. I hope you understand, it will be motivation for us.
Thanks,
Do you want selected item in the dropdownlist to be displayed in the gridview or fetch some item from a data source based on the selected item in the dropdownlist and display it in the gridview.
Hi,
i successfully created the JAVA
Applet and embedded it in the HTML page.
The applet class is as follows:
import javax.swing.JApplet;
import java.awt.Graphics;
public class HelloWorld extends JApplet
{
@Override
public void paint(Graphics g)
{
g.drawRect(0, 0,
getSize().width - 1,
getSize().height - 1);
g.drawString("Hello World !", 5, 15);
}
}
And above is embedded in the HTML file as follows:
<applet codebase="../../build/classes" code="applettest/HelloWorld.class" width=350 height=200></applet>
I successfully view this page in browser.But there is a small problem.
Whenever i minimize the browser or visit anathor page or just go away from the web page with applet without closing it and come back to the same page. The same applet doesn't display clear. Well in my case i can see the Hello World but i also see some background with view of previous visited window. I hope you all experienced programmers know what i am talking about.
I just need to see my applet as clean as i see it first time and every time i go away from it and come back .
Thanks
The problem was in HTML file while embedding the applet. In the applet tag i had to use both the combination of code and codebase attribute and set it to proper value. I still exactly don't know what is the problem and what is its proper use. But through series of Hit and Trial i just made it worked. The code in the HTML file is as follows:
<applet codebase="../../build/classes" code="applettest/HelloWorld.class" width=350 height=200></applet>
Thanks
Hi harsh
I solved the problem.
Thanks for taking interest in my problem anyway.
if i do this i get the error message as FileNotFoundException. My class file is in different location than the html file so i used codebase instead of code.
when i debug the HelloWorld.java i can output is fine but when i view this in browser it doesn't display.
Hi,
I am new to java programming.
I have been creating a simple applet. Which is as follows:
public class HelloWorld extends JApplet
{
public void paint(Graphics g)
{
g.drawRect(0, 0,getSize().width - 1,getSize().height - 1);
g.drawString("Hello world!", 5, 15);
}
}
This code is saved in a file named HelloWorld.Java
I embedded this applet in html as follows:
<applet width=300 height=300 codebase="../../build/classes/applettest/HelloWorld.class"> </applet>
But it doesn't display. Just the java image gets displays ("some sort of progress status type") you know
How can i display this applet.
Please help
You question is not clear. Please be precise.
To check multiple check boxes you must have it at first. But i don't see it in your code. If you try to check multiple check boxes with the same GroupName from codebehind it will allow you to do so but if user tries to select multiple checkboxes with the same group name in the web page it will just not happen.
Well, checking length in asp.net is not quite easy. But you can restrict user from entering characters more that allowed limit.
set the MaxLength property of textbox to the number of characters you want to allow.
Well the draw back of this method is that, it does not display any error to the user that they are entering more characters than allowed.
But you will not need to display. the error.
I did this several times and it is working.
or you can use javascript to validate.
Were you able to fire the GridView1_RowUpdating event. If not then Check you GridView defintion in aspx page to associate onrowUpdating attribute of GridView.
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="true"
AutoGenerateEditButton="true" AutoGenerateDeleteButton="true"
onrowediting="GridView1_RowEditing" onrowupdating="GridView1_RowUpdating" >
</asp:GridView>
My Gmail Id is: randhir.kr.yadav@gamil.com
Well you able to fire the Gridview1_RowUpdating event.
And you are updating all the rows in the GrieView1_RowUpdating method.
You are using loop to iterate through rows.
I think this is the wrong way.
Wait, i am simulating the same kind of conditon on my computer .
and i will tellyou.
Whenever you post a thread in a daniweb and you are expecting a reply. Also log on to you msn or gmail, or yahoo messenger so that you know someone has replied to your thread.
This way you can quickly get your problem solved and other free developers can give time to solve your problems.
Well, this is the way i do.
or
As you wish.
How did you load the script for the first time.
You must have forgotten to add GridView1_RowUpdating event to the GridView.
I guess there is something wrong with the body of GridView1_RowUpdating method.
When you clik the edit button ,only the row in which you clicked Edit button becomes editable.
Am i right..
So, i guess you should write the code to update only that row.
Answer to my above questions and i will solve the problem quickly.
I am online now and free.
I am waiting.
Then i guess you have written wrong SQL Statement to extract the deliveryboy names in this part of the code as you have written:
SelectCommand="SELECT [StaffID] FROM [StaffRegis_Table] where designation=@designation">
but it should be written as below:
SelectCommand="SELECT [StaffID] FROM [StaffRegis_Table] where designation='deliveryboy'">
All i want to say is that you are using a parameter "@designation" to be passed the sqlstatement. Don't do that, directly pass the value to the "designation" of where condition as shown above in my code suggestion.
From where are you supposed to provide the value for Where condition i.e @designation for the SqlDataSource of DropDownlist. Giive it a thought.
I am online now, i can help you immediately.
and what do you mean by statement "At the same time how to only display rows of selected gridview only." Please be precise.
First solve your problem of "Must declare the scalar variable "@designation"" and then we will look at the other problem.
Man,
You can't just mark the thread Solved and forget about it.
Please tell,
Was i helpful to you.
If i was helpful , Please add it to my reputation.;)
Thanks
so make the textbox readonly and it will be readonly
simple isn't it
well, your problem was to load the page in new window.
Which you did successfully.
Did you use the page_load event of new page. Try to get the value from the query string in the page_load event and then load the gridview in the Page_Load event.
This should probably work . I will sure look over this problem.
Your problem of opening new page from the code behind was solved. So you should mark this thread as solved and start new thread.
Dont forget to enclose your code in code tags like this:
[code=C#] Response.OpenNewDamnPage("DeviceInformation.aspx?arg=" + e.CommandArgument);
[/code]
this will display as
Response.OpenNewDamnPage("DeviceInformation.aspx?arg=" + e.CommandArgument);
Use this exactly for your case:
protected void button1_Click(object sender, EventArgs e)
{
Response.Write("<script type='text/javascript'>window.open('DeviceInformation.aspx?arg=" + e.CommandArgument + "','_blank');</script>");
}
Hey
Try This
protected void button1_Click(object sender, EventArgs e)
{
Response.Write("<script type='text/javascript'>window.open('NewPageUrlWithArgument.aspx','_blank');</script>");
}
This sure will work
If it solves your problem mark the thread as solved.
Sorry about enclosing tags in code blocks, i was not able to explain it properly:
Here follow this to enclose your code in the code blocks:
[code=C#] String str = "This is a string.";
[/code]
use EditItemTemplate and in the EditItemTemplate make only the field you want editable as editable . for the rest use labels to show the fields or readonly textboxes.
<FAKE SIGNATURE>
A Software Development Company
or contact me at <FAKE SIGNATURE> , send me comment or subscribe to my blog or follow me.
Hey here is my fully functional GridView with edit functionality.
To make gridview editable follow the code in GridViewSiteConfiguration_RowEditing method shown below:
If you are confused of this much of code, don't worry, i will give you simple advice:
The thing is extremely simple:
1. Set the edit index of gridview to new editindex which comes from e argument of the method as follows:
GridViewSiteConfiguration.EditIndex = e.NewEditIndex;
2. And after that load the gridview again like this:
loadGridView();
3. and don't forget to define the EditItemtemplate in the gridview as i have defined below
Use you brain and make necessary adjustmenst and you will get it
<asp:GridView ID="GridViewSiteConfiguration" runat="server" CellPadding="4" ForeColor="#333333"
DataKeyNames="id" GridLines="None" AutoGenerateColumns="false" BorderColor="#E5E5E5"
BorderStyle="Solid" BorderWidth="1px" OnRowEditing="GridViewSiteConfiguration_RowEditing"
OnRowCancelingEdit="GridViewSiteConfiguration_RowCancelingEdit" OnRowUpdating="GridViewSiteConfiguration_RowUpdating">
<RowStyle BackColor="#EFF3FB" />
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#99CCFF" />
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<table class="ViewPagesTable">
<tr>
<td class="FirstCol">
Config Key
</td>
<td class="SecondCol">
Value
</td>
<td class="ThirdCol">
Options
</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table class="ViewPagesTable">
<tr>
<td class="FirstCol">
<%# Eval("ConfigKey") %>
</td>
<td class="SecondCol">
<%# Eval("Value") %>
</td>
<td class="ThirdCol">
<asp:LinkButton ID="linkButtonEdit" runat="server" Text="Edit" CommandName="Edit"></asp:LinkButton>
</td>
</tr>
</table>
</ItemTemplate>
<EditItemTemplate>
<table class="ViewPagesTable">
<tr>
<td class="FirstCol">
<asp:Label ID="lblId" runat="server" Visible="false" Text='<%# Eval("Id") %>'></asp:Label>
<asp:TextBox CssClass="SiteConfigTextBoxes" ID="txtConfigKey" MaxLength="50" runat="server"
Text='<%# Eval("ConfigKey") %>'></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtConfigKey"
Text="*" ErrorMessage="ConfigKey field cannot be empty."></asp:RequiredFieldValidator>
</td>
<td class="SecondCol">
<asp:TextBox CssClass="SiteConfigTextBoxes" ID="txtValue" MaxLength="8000" runat="server"
Text=' <%# Eval("Value") %>'></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" …
If you are using FormView you must have defined templates for ItemTemplate and EdititemTemplate
To make only one field editable in the EditItemTemplate make only the field you want editable as Editable and for rest others make it non editable , this means they should be displayed in label instead of textbox and for the one that should be editable make it TextBox
<FAKE SIGNATURE>
A Software Development Company.
Here is your solution:
Just replace your try catch block with my code and it will work:
Here is my code
try
{
using (FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read))
{
using (StreamReader sr = new StreamReader("TestFile.txt"))
{
String line;
while ((line = sr.ReadLine()) != null)
{
Console.WriteLine(line);
using (StreamWriter sw = new StreamWriter("TestFile.txt"))
{
sw.Write("\n");
sw.WriteLine("line\n");
sw.WriteLine("test");
}
}
}
}
}
catch (Exception e)
{
// Let the user know what went wrong.
Console.WriteLine("The file could not be read:");
Console.WriteLine("File: " + e.FullPath + " " + e.ChangeType);
Console.WriteLine("File: " + e.Name);
Console.WriteLine("Folder:" + Path.GetDirectoryName(e.FullPath));
Console.WriteLine(d.Message);
continue;
}
And I have few suggestions for you:
1. While writing code every time you open a bracket immediately place it's corresponding closing bracket and then go back inside the bracket and then type. This rule applies not only to brackets but for all the codes which has corresponding opening and closing code. For example doublequotes(") and single quotes(') and all of them.
2. When you post your code on Daniweb always enclose the code in code tags like this "
string str = "this is a string";
"
This will display as
string str = "this is a string";
Well goodluck
If you have any problem send messages directly at
info@bizpersonnel.com
www.bizpersonnel.com
A Software development Company
Use the first method i have suggested. I think it should work.
Something like that.
But you should all these things in Page_Load method of the web page.
you can extract the value of a query string and store in the local string variable lke this:
string searchvalue = Request.QueryString("SearchItem");
//and then use thevalue of the variable as shown below
//Get Items by name search
IList<Item> Items = DaoFactory.FindAll<Item>(Where.Item.Name.Like("%" + searchvalue + "%") || Where.Item.Description.Like("%" + searchvalue + "%"));
_gdvItems.DataSource = Items;
_gdvItems.DataBind();
or you can directly pass Request.QuertyString("SearhItem") to Like method of above code.
I have been developing a asp.net application in which i have to mail to large number of user an email.
I used the classes in System.Net . Every thing is fine, there are no errors in the page.
But while sending mail i get an exception:
as follows:
SPAM Score exceeded Threshold
Can anybody tell what is this:
How do i send mail to large number of users using ASP.NET.
Thanks.