|
Hi all
I want to know How can we define no of rows in a window.
but this script writes all rows of that gridView.
So How can we control no of rows so we can print as many no of record as we want. Is there any other function Please let me know.
Your help is highly appreciated, Thanks
function CallPrint(strid)
{
var prtContent = document.getElementById(strid);
var strOldOne=prtContent.innerHTML;
var WinPrint = Window.open('','','letf=100,top=100,width=1000,height=1000,toolbar=0,scrollbars=1,status=0,resizable=1');
WinPrint.document.write(prtContent.outerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
}
Bajrang Singh
Using .net 2.0 (VS2005)
|
|
|
|
|
Hi
I responded to a post today regarding built in datasource vs custom data access objects.
After replying I began to think about these and quickly came to the realisation that I know jack all to be fair.
Obviously I shall be reading around on msdn etc but I would just like some opinions. My question is this.
How good is the datasource object regards efficiency, error handling, working under load etc.
The obvious advantage is speed of development but what are its major disadvantages?
I understand this is a very wide topic so just pointers and opinions would be great.
Thanks
Dan
|
|
|
|
|
Hi! The following problem is giving me headache now for a few days. I`m writing a aspx Webpage with C# code-behid.
In the Default.aspx Page I have a literal container which loads HTMLPages from a certain folder.
(I call //host/Default.aspx?/folderpath/filneame.htm, check for the path behind the ? char and call the HTML Page with StreamReader. Finally it is added to the litcontrol) This works fine, the only problem is, that everybody can access the file directly by inserting the path in the browser. I tried it with a web.config file which denied access for non authorized users, even denied the GET Method, but still no success.
Does anybody know how to do this? I mean the files of this certain folder should just be allowed to called if you are authorized by my Database. A direct access should be denied.
Help would be appreciated
|
|
|
|
|
ezazazel wrote: the only problem is, that everybody can access the file directly by inserting the path in the browser
Only if they know the filename... you could give it, or append to it's name before saving, a randomly generated string (say 6 chars min) and it'll be all but impossible that anyone will ever manage to browse to it. If the file/s change/s, you could store the filename/s in the db (or an xml file) and recall as needed...
For that matter, of course, you could just store the file contents in the db to begin with.
Yes, no doubt the Authentication classes can solve this problem more elegantly, but as you say.... you need some headache tablets handy... I must say, I've never managed to get my head around them....
|
|
|
|
|
Hi.am doing one music.in this site am keeping all the songs in the webserver.so while opening the songs page user can select all songs or some songs for play.after selecting the songs am adding the selected songs into play list.so my question is where i can keep this play list.when i tried to add this playlist into client machine getting access denied error.suppose if am storing that playlist in the server it will take time to play all the songs from the playlist,and also if am keeping in the server so many files will come in the server and size also increase.so what is the solution for playing the selected songs very fastly.somebody can get me some idea.
|
|
|
|
|
You will have to keep it on the server, obviously.
Kurian_Kurian wrote: suppose if am storing that playlist in the server it will take time to play all the songs from the playlist
How so ? The *songs* are on the webserver, but you think keeping a list of their names on the web server is going to be a speed issue ?
Kurian_Kurian wrote: so what is the solution for playing the selected songs very fastly
Can't you just serve them in order ? How do you play them ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I have 2 RadioButtons in my page, and I have to change the visibility of 2 Asp Panels depending on which RadioButton is clicked. I use this JavaScript function for this:
function ToggleRbn1(p)
{ //alert(p.id);
if(document.getElementById(p.id).checked == true)
{
var id1 = document.getElementById('<%=pnlType1.ClientID%>');
var id2 = document.getElementById('<%=pnlType2.ClientID%>');
//alert(id2.innerHTML);
id2.style.display = "none";
id1.style.display = "block";
}
}
function ToggleRbn2(p)
{ //alert(p.id);
if(document.getElementById(p.id).checked == true)
{
var id1 = document.getElementById('<%=pnlType1.ClientID%>');
var id2 = document.getElementById('<%=pnlType2.ClientID%>');
id2.style.display = "block";
id1.style.display = "none";
}
}
I initially set Panel2 as invisible, but id2 would give error that time. If I keep it visible=true, then there is no problem. But that is not the requirement, Panel2 should be invisible at Page_Load, it should be visible only when user clicks RadioButton2. Error is: "Object Required".
Regards,
Blumen
|
|
|
|
|
|
Hi Ben,
I have put alert for parameter 'p', and value was correct. Anyways thanks alot for that article of yours, let me check that out and i'll get back to you.
Regards,
Blumen
|
|
|
|
|
hi All!
in mu asp.net web application, some pages are anonymously accessible, some pages required authentication & some pages required authentication + SSL .
i want to apply form authentication. how can i achieve this?
Thanks & Regards,
SAMir Nigam,
Software Engineer,
STPL, Lucknow, India.
|
|
|
|
|
I created my web controls dynamically then add them into panel control.
example:
TextBox txt=new TextBox();
txt.ID="test";
Panel1.Controls.Add(txt);
...well,controls will be displayed correctly but when I postback the page by using button or else ,the data entered on TextBox control will disappear.
My friends ,how can I solve this problem?
hi all frieds!!
piece in home,piece in world!
|
|
|
|
|
Your controls need to be added before the page load event, otherwise they don't exist when the viewstate tree is recreated, so the values are lost.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
well done...I tried Page_Init event..it creates Label control without causing any exception..but when I added my textbox type control to page it throws an exception that "the TextBox type control must be in form runat=server tag"..
please any suggestion?
hi all frieds!!
piece in home,piece in world!
|
|
|
|
|
Hi,
I would like to know how I can add a headerRow to a gridview, before I show it on the page. I will never know how many columns there will be(get amount of columns from another source), so I have to loop through an array each time, check how many columms there are, and then create a column(with text name) for each of the array items.
How will I add code to the following code, to add a header row?
<br />
'dtInvoice = datatable 'gdvInvoice = gridview<br />
gdvInvoice.DataSource = dtInvoice<br />
gdvInvoice.EmptyDataText = "No Data to Display"<br />
gdvInvoice.PagerSettings.Position = PagerPosition.Top<br />
gdvInvoice.AllowSorting = True<br />
<br />
Dim keyArray() As String = {ViewState("AppPrimaryKey")}<br />
gdvInvoice.DataKeyNames = keyArray<br />
<br />
gdvInvoice.DataBind()<br />
gdvInvoice.Visible = True<br />
|
|
|
|
|
i want to retrieve primary key of parent table and then send this key to child table,as they have one-one relationship
i've written code
string id = "SELECT MAX(c_id) FROM call_history";
SqlCommand com1 = new SqlCommand(id, conn);
SqlDataReader dr = com1.ExecuteReader();
if (dr.Read())
{
int i = Convert.ToInt32(dr.GetValue(1));
}
strQuery1 = "INSERT INTO call_log(c_id,c_add)VALUES("+ i +",'"+textBox2.Text +"')";
SqlCommand commm = new SqlCommand(strQuery1, conn);
commm.ExecuteNonQuery();
but it is goiving an error on insert atement that
"Use of unassigned local variable 'i' "
$h@ma!|@
|
|
|
|
|
$h@ma!|@ wrote: int i = Convert.ToInt32(dr.GetValue(1));
Your variable is defined inside your brackets, but you try to use it after it's dropped out of scope. Move your } to the bottom of this code block and it will work.
I'd recommend reading a book on C#, if you're unaware of hte scoping rules.
$h@ma!|@ wrote: strQuery1 = "INSERT INTO call_log(c_id,c_add)VALUES("+ i +",'"+textBox2.Text +"')";
I recommend you do some reading on SQL injection attacks. This sort of code allows people to run any SQL they like on your database.
$h@ma!|@ wrote: $h@ma!|@
Does that translate to shemale ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
this time i defined i globaly but still having the same problem...is there any problem in the insert statement??
have i written the sql command rite??/
$h@ma!|@
|
|
|
|
|
hi,
i am using a report viewer control in my application.i have many records with the same value in name column.i have to group the name n display it once in the report with its other details
ex:
name job
zari swengineer
swtester
businessanalyst
zari
|
|
|
|
|
Are you making use of the Crystal Report Wizard to create your report or are you creating your report in code? This you have to do in the report itself, since the viewer only do what it says: View.
There is 2 solutions.
You can either create a grouping for that field
OR
You can sort that field so that all that names are together then you format that field to tell him to suppress duplicates. That way you will see the name once.
|
|
|
|
|
Hi,
I'm using MS Access 2003 database with c#.net 2003. Now I've a comobo, in which department name are shown and onchangeindex i use to get department code, show i textbox. Now the problem is this when i add department no 11 in the database, my comobox stop working and i got javascript error:
Error:Invaild Syntax in statusbar.
Kindly help where i made a mistake ( In web code or database) I use normal database settings.
Thanks
|Muhamad Waqas Butt|
waqasb4all@yahoo.com
www.sktech.freewebspace.com
|
|
|
|
|
Please post your code or run your application with the Break point and try to locate in which line the error shows.
We are not magic man without seeing the code how can we tell where the error is.
Regards,
Satips.
|
|
|
|
|
Here is a code:
try
{
string cmdstr="SELECT * FROM tablename where dp_head='"+ dpdhead.SelectedValue +"'";
con=new OleDbConnection(cons);
cmd=new OleDbCommand(cmdstr,con);
con.Open();
OleDbDataReader dr = cmd.ExecuteReader();
bool chkrec = dr.Read();
if(chkrec == true)
{
string dasv = dr.GetInt32(0).ToString();
txtacno.Text = dasv;
}
//
Output
'/LM/w3svc/1/root/expdemo-5-128280938191702288': Loaded 'c:\windows\microsoft.net\framework\v1.1.4322\temporary asp.net files\expdemo\280c9982\bd477ac7\gottf48d.dll', Symbols loaded.
// Now
|Muhamad Waqas Butt|
waqasb4all@yahoo.com
www.sktech.freewebspace.com
|
|
|
|
|
You may be better off by using a Parameter List for your OleDBCommand Object.
replace your appropriate lines:
string cmdstr = "SELECT * FROM Tablename where field = @fieldvalue;";
cmd = new OleDBCommand(cmdstr,con);
cmd.Parameters.AddWithParameter("@fieldvalue",dpdhead.SelectedValue);
Parameter Lists help organization And is another obstacle for Hackers.
Also look to this:
string dasv = dr[0].ToString();
|
|
|
|
|
Respected Gurus
I m using following code to import data from an excel file..
It works fine except one problem that
whenever i m trying to delete the file which i have saved on the server by using
file.delete(strfilename)
i left with the error "you do not have permission"
I think i have not closed the excel file.
how can i close it programmatically so that i can delete it also.
Dim strfilename As String
' Check the first open file dialog for a value
If Not (Me.File1.PostedFile Is Nothing) Then
' Get a reference to PostedFile object
Dim attFile As HttpPostedFile = File1.PostedFile
' Get size of the file
Dim attachFileLength As Integer = attFile.ContentLength
'Make sure the size of the file is > 0
If attachFileLength > 0 Then
' Get the file name
strfilename = Path.GetFileName(File1.PostedFile.FileName)
'Preceed the file name with "attachments/" so
'the file is saved to our Project's attachments Folder
strfilename = "Uploads/" + strfilename
'Save the file on the server
File1.PostedFile.SaveAs(Server.MapPath(strfilename))
End If
End If
Dim strConnectionString As String = String.Empty
'----------------------------------------------------------
'strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Driver=Microsoft Text Driver (*.txt;*.csv);Data Source=" + Server.MapPath(strfilename) + ";Extensions=asc,csv,tab,txt;Persist Security Info=False"
'----------------------------------------------------------
strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath(strfilename) + ";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"""
Dim cnCSV As New OleDbConnection(strConnectionString)
cnCSV.Open()
Dim cmdSelect As New OleDbCommand("SELECT * FROM [sheet1$]", cnCSV)
cmdSelect.CommandType = CommandType.Text
Dim daCSV As New OleDbDataAdapter
daCSV.SelectCommand = cmdSelect
Dim ds As New DataSet
daCSV.Fill(ds)
after using the dataset.
at last i am trying to delete the file.
which give me the error.
Please Help.
|
|
|
|
|
please check out your system configuration. have your system has permission to delete any file. could be possible this.
Devjit
|
|
|
|