|
The problem is that I want to bind a data grid or a repeater in a background thread coz the binding process is a time consuming task that might slow down the response. I already binded the grid in the background thread but the problem is to update the UI from that thread.
|
|
|
|
|
hello to all,
i m working on a project which have functionality of chat room. If any new user comes then the new user must show on the page on client side which is already opened , without any post back. so please tell me how to send messages/alerts from server to client side.
with regards ,
sachin jangir
|
|
|
|
|
a) you can't do this directly, once connection is closed there is no way for the server to connect to the client.
b) you can use an HTTP streaming technique where the connection is never closed and the server flushes javascript down it (look it up on ajaxpatterns.org)
c) use an Ajax request at regular time intervals to check for recent activity
d) please don't ask for code its too complicated
|
|
|
|
|
Hi,
I am using ASP.NET 2005. In my project I am using CrystalReport which cotains 50 columns. At the runtime it binds as per the query.
Suppose, as per the query there are 5 columns so it binds with 5 columns. If it gets 20 columns then it binds with 20 columns, like that, but at the time of printing(by using the print button of the CrystalReportViewer ToolBar) it prints upto the length of CrystalReportViewer ToolBar showing on the Browser.
Also there is a problem it shows all the columns binds at runtime in IE, not in Mozila/Netscape. In mozila/Netscape it shows only upto the length of the CrystalReportViewer ToolBar.
Please help.
Thanks & regards
|
|
|
|
|
I want to have a File uploader inside a grid view control. I have bound this grid view to a datasource, so can I use the file uploader inside the gridview? I will have to writer manual coding to upload the file, isn't it?
can somebody tell me how I can sent the filename of the uploaded file to the datasource parameter??
thanks for any answer!!!
|
|
|
|
|
You can put a file uploader in a gridview control, you just need to use a Item Template for the column you want it to be in.
Here is some sample code from Microsoft help:
Visual Basic
Protected Sub Page_Load(ByVal sender As Object,
ByVal e As System.EventArgs) Handles Me.Load
If IsPostBack Then
Dim path As String = Server.MapPath("~/UploadedImages/")
Dim fileOK As Boolean = False
If FileUpload1.HasFile Then
Dim fileExtension As String
fileExtension = System.IO.Path. _
GetExtension(FileUpload1.FileName).ToLower()
Dim allowedExtensions As String() = _
{".jpg", ".jpeg", ".png", ".gif"}
For i As Integer = 0 To allowedExtensions.Length - 1
If fileExtension = allowedExtensions(i) Then
fileOK = True
End If
Next
If fileOK Then
Try
FileUpload1.PostedFile.SaveAs(path & _
FileUpload1.FileName)
Label1.Text = "File uploaded!"
Catch ex As Exception
Label1.Text = "File could not be uploaded."
End Try
Else
Label1.Text = "Cannot accept files of this type."
End If
End If
End If
End Sub
Hope that helps.
Ben
C#
protected void Page_Load(object sender, EventArgs e)
{
if(IsPostBack)
{
Boolean fileOK = false;
String path = Server.MapPath("~/UploadedImages/");
if (FileUpload1.HasFile)
{
String fileExtension =
System.IO.Path.GetExtension(FileUpload1.FileName).ToLower();
String[] allowedExtensions =
{".gif", ".png", ".jpeg", ".jpg"};
for (int i = 0; i < allowedExtensions.Length; i++)
{
if (fileExtension == allowedExtensions[i])
{
fileOK = true;
}
}
}
if (fileOK)
{
try
{
FileUpload1.PostedFile.SaveAs(path
+ FileUpload1.FileName);
Label1.Text = "File uploaded!";
}
catch (Exception ex)
{
Label1.Text = "File could not be uploaded.";
}
}
else
{
Label1.Text = "Cannot accept files of this type.";
}
}
}
|
|
|
|
|
Hi dears,
each user in my website can upload her photo into a directory named 'UserAvatar' . when a user wants to delete her photo an error occured with this message : access to the path c:\domains\mywebsite\UserAvatar\1.jpg is denied.
to fix this problem I got Write access role to ASPNET user for UserAvatar directory. the code is :
<br />
System.IO.DirectoryInfo dInfo = new DirectoryInfo(path);<br />
System.Security.AccessControl.DirectorySecurity dSecurity = dInfo.GetAccessControl();<br />
dSecurity.AddAccessRule(new System.Security.AccessControl.FileSystemAccessRule("ASPNET",System.Security.AccessControl.FileSystemRights.Write,System.Security.AccessControl.AccessControlType.Allow));<br />
dInfo.SetAccessControl(dSecurity);<br />
but the error was not fixed.
What should I do ???
thx,
www.behzadi.net
|
|
|
|
|
Unless your ASPNET user has the appropriate access, you probably won't be able to set this programatically (and if they do have access, then you won't need to...)
Also, and i could be wrong about this, but will they not need modify rights to delete something?
|
|
|
|
|
How can I know that I have permission to set this programmatically or not ? and you are right about appropriate access for ASPNET user , I checkd that the user ASPNET has fullcontrol access on UserAvatar directory ,but why this error occures in deleting files ?
www.behzadi.net
|
|
|
|
|
Hi All,
I Created a Registration Page with only username,Pwd,Email,Contactno and Address fields.
1.when a Enter user with different Email then it is saved the details in Database.
2.My Code is working fine when a Enter username with Already Existing mail id then it is not taking.But only problem is msg is not displaying client side.
How to display msg .Pls find my code also.
procedure
---------
CREATE Procedure SP_Login
(
@Username varchar(50),
@pwd varchar(50),
@Email varchar(50),
@ContactNo varchar(50),
@Address varchar(50),
@Ret_val Int = Null Out,
@Ret_msg Varchar(75) = Null Out
)
AS
IF EXISTS(SELECT * FROM Login WHERE Email=@Email)
BEGIN
RAISERROR('The email address already exists', 16, 1)
END
ELSE
BEGIN
INSERT INTO Login (Username,pwd,Email,ContactNo,Address)VALUES(@Username,@pwd,@Email,@ContactNo,@Address)
END
If @@Error = 0
BEGIN
SET @RET_VAL = 1
SET @RET_MSG = 'DETAILS INSERTED SUCCESSFULLY.'
END
ELSE
BEGIN
SET @RET_VAL = 0
SET @RET_MSG = 'ERROR : Error in Inserting Details.'
END
GO
codebehind
----------
Try
conObj = New SqlConnection("Data Source=B4B-2F-323-CK26;user id=sa;password=sa;Database=TEST")
conObj.Open()
tranObj = conObj.BeginTransaction
cmdObj = conObj.CreateCommand
cmdObj.Transaction = tranObj
With cmdObj
.CommandText = "SP_Login"
.CommandType = CommandType.StoredProcedure
End With
With cmdObj.Parameters
.Add(New SqlParameter("@UserName", SqlDbType.VarChar, 50)).Value = txtUserName.Text
.Add(New SqlParameter("@pwd", SqlDbType.VarChar, 50)).Value = txtPwd.Text
.Add(New SqlParameter("@ContactNo", SqlDbType.VarChar, 50)).Value = txtPhoneno.Text
.Add(New SqlParameter("@Email", SqlDbType.VarChar, 50)).Value = txtEmail.Text
.Add(New SqlParameter("@Address", SqlDbType.VarChar, 50)).Value = txtAddress.Text
retvalp = .Add("@RET_VAL", SqlDbType.Int)
retvalp.Direction = ParameterDirection.Output
retmsgp = .Add("@RET_MSG", SqlDbType.VarChar, 50)
retmsgp.Direction = ParameterDirection.Output
End With
cmdObj.ExecuteNonQuery()
If retvalp.Value = 1 Then
tranObj.Commit()
lblmsg.Text = retmsgp.Value
Else
tranObj.Rollback()
lblmsg.Text = retmsgp.Value
End If
Catch ex As Exception
Response.Write(ex.ToString())
Finally
If Not tranObj Is Nothing Then tranObj.Dispose()
conObj.Close()
cmdObj.Dispose()
End Try
|
|
|
|
|
I want to draw a selection rectangle on an image object:
1) image normal
2) move mouse over the image
3) click over a point of the image
4) the drag to get a selection rectangle (like selection icons in windows)
How can i do?
|
|
|
|
|
Yes this is possible but quite complicated. You'd need to use Javascript and DOM methods, go look them up, its unlikely anyone will be able to give you code for this.
|
|
|
|
|
Hi,
We are using treeview control(vs.net 2005).For loading the nodes till 2-3 levels its working fine but this treeview is used for populating library books and chapters of each books should be displayed in the next levels when selecting the appropriate book .This takes a lot of time.
Is there anyother way(javascript or any other control) to populate the library details speedly(It needs to be a in a treeview manner),Also selecting each book there shouldn't be any post backs.
Please help me out with a solution.
Thanks & Regards,
Jeeva
|
|
|
|
|
|
Hi there.
In my website, i want to use the a dropdown of all the countries, and together with that, i want to convert the currancy from e.g X to X(country). I need to do this by useing the information of website, that is updated every day, and store that info into a database.
Is this possible? can anyone help me with this task?
Thanks
|
|
|
|
|
There will be something in asp.net like internationalization. I found that in java
|
|
|
|
|
Hi, how can i use the auto documentation tool from microsoft visual studio.net please??
thanks very much for any feedback.
Adrian De Battista - Web Designer, Web Programmer, Software Programmer From Malta. My Website .. www.MaltaTrade.org
|
|
|
|
|
What is the best practice if i want some information to be available in all the forms. Is it good to have global variables. If not then please tell me some other alternative.
Mohinder Singh
|
|
|
|
|
I think one of the best way is creating the datacontainer class and storing there by having private variables and public properties.
There are many ways to store but depends on the size,security ...........
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|
|
can u give me the code for this.
Thanks in advance
Mohinder Singh
|
|
|
|
|
To make sessions you need to create it like this;
Session("Name") = "Adrian"
This Session is now stored with a string called "Adrian". This session can be called from any page you want within the project.
If you want to dispose the session;
Session.RemoveAll()
I hope i helped you in some ways.
Adrian De Battista - Web Designer, Web Programmer, Software Programmer From Malta. My Website .. www.MaltaTrade.org
|
|
|
|
|
You can use sessions also
|
|
|
|
|
how to use session. can u send me the code for it.
Thanks in advance.
Mohinder Singh
|
|
|
|
|
Suppose that I want to send a private message to a person and sender name and reciever name is saved in 2 session variables like this.Session["sender"] and this.Session["Reciever"].
Now I open 2 browser and in browser one ,click on person1 "send message" bottun and go to a page to writing message body, and then in browser 2 click on person2 "send message" bottun and go to a page...!
Now I go to browser 1 and click on "Send" bottun. the value of this.Session["reciever"] is person2 but I want to send message to person 1 .
What should we do in this case ?
|
|
|
|
|
hi all,
In my page,I have to enter only year(eg 1999) in the textbox.but it should be inserted as datetime format in DB.
how to convert year to datetime format in c#.
Eg: 1999 to 1/1/1999 12:00:00 AM
Plz give ur suggestions
thanks in advance
cheers
sangeet
|
|
|
|