|
I am currently developing a web application using Microsoft's Visual Studio with C# code-behind-page. When a new item is selected in a listbox control, the display in the listbox is scrolled so the selected item appears at the top of the listbox. I would like to change this behavior so the selected item appears somewhere in the middle of the display. In this situation, it is important for the user to see the items before and after the selected item. I have been unable to figure out a way to do this. Is this possible? Thanks.
Dave
|
|
|
|
|
Although ASP.NET is new to me, I still feel foolish asking such a simple question about a common task required for millions of web sites. I've spent hours seeking the answer, but without success, probably because it's so common and simple that everyone is expected to know it.
An InformationRequired page has an 'Agree to Terms & Conditions' checkbox. If it's unchecked when the Submit button is clicked, a message box is displayed; If it's checked when the Submit button is clicked, a Content page is displayed in a new window. I can do everything except the last bit. Here's the code:
----------------------------------------------------------------------
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
'Has the visitor agreed to the T&C?
If chkTC.Checked Then
'Open new browser window for Content.aspx
CAN ANYONE PROVIDE THE CODE TO GO HERE, PLEASE?
Else
MsgBox("You must agree to the TERMS & CONDITIONS by selecting the box before proceeding.")
End If
End Sub
End Class
----------------------------------------------------------------------
|
|
|
|
|
bhssc wrote: 'Open new browser window for Content.aspx
Use Page.RegisterStartupScript(Name,Script) and inside that use window.open('your new page name')
|
|
|
|
|
One reason that you can't find any information about it, is beacuse it's impossible. You can't open a browser window from the server code, you can only do that in the browser.
You have to use Javascript to open a new window. One way is to add the script to the page the way that Navaneeth suggested.
You can't use a message box in a web application either. The message box is only displayed in the special situation where the client computer and the web server is the same computer, and the user account running the web page in the web server is the same user account where the browser is running. In other words, it only works when you are testing the site on your own computer.
---
single minded; short sighted; long gone;
|
|
|
|
|
Oh, dear me! And I thought that .NET was going to make life easy!
Thanks, friends, for saving me more wasted time.
|
|
|
|
|
bhssc wrote: Oh, dear me! And I thought that .NET was going to make life easy!
The pages are still displayed in a browser. No server technology can get around the limitations of the browser or the limitations of the server-client model. You can do a lot in ASP.NET, but you can't get around the browser.
---
single minded; short sighted; long gone;
|
|
|
|
|
I amd using the dataobject method and a gridview. I get this error when running the code:
ObjectDataSource 'ObData' could not find a non-generic method 'updateUser' that has parameters: UserID, UserFirstName, UserLastName.
I have researched this issue and applied various solutions but none of them have fixed the problem.
Here is the .aspx file:
asp:objectdatasource id="ObData" runat="server" typename="dao.userdao" selectmethod="getAllUsers" updatemethod="updateUser" >
[DataObjectMethod(DataObjectMethodType.Update)]
public static int updateUser(UserData userData)
{
MySqlCommand cmd = new MySqlCommand();
try
{
DB_Connection conn = new DB_Connection();
cmd.Connection = (MySqlConnection)conn.DBConnect();
cmd.CommandText = "updateUser";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new MySqlParameter("USERID", userData.UserID));
cmd.Parameters.Add(new MySqlParameter("USER_LAST_NAME", userData.UserLastName));
cmd.Parameters.Add(new MySqlParameter("USER_FIRST_NAME", userData.UserFirstName));
int i=cmd.ExecuteNonQuery();
return i;
}
finally
{
cmd.Connection.Close();
}
}
Here is my stored procedure in MySQL:
REATE DEFINER=`USERDB`@`%` PROCEDURE `updateUser`(IN USERID VARCHAR(7),IN USER_LAST_NAME VARCHAR(40), IN USER_FIRST_NAME VARCHAR(20)
BEGIN
UPDATE USERS SET USER_LAST_NAME = USER_LAST_NAME, USER_FIRST_NAME = USER_FIRST_NAME where USER_ID = USERID;
END
I appreciate any help.
-- modified at 9:05 Thursday 20th September, 2007
|
|
|
|
|
Look at:
newbieAl wrote: ObjectDataSource 'ObData' could not find a non-generic method 'updateUser' that has parameters: UserID, UserFirstName, UserLastName.
and:
newbieAl wrote: [DataObjectMethod(DataObjectMethodType.Update)]
public static int updateUser(UserData userData)
{
The parameters do not match!
I think you have forgotten to define the UserData as DataObjectTypeName in the DataSource.
Or you have to add the needed parameters to the UpdateUser method. Both should work.
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
I thought I didn't have to pass the individual paramters and that passing the object would be suffecient. Also when I add dataobjecttypename="userdata" I get this error:
The data object type specified in the DataObjectTypeName property of ObjectDataSource 'ObData' could not be found.
|
|
|
|
|
newbieAl wrote: I thought I didn't have to pass the individual paramters and that passing the object would be suffecient.
That's correct. The DataobjectTypeName is exactly for this.
newbieAl wrote: Also when I add dataobjecttypename="userdata"
You have to set a fully qualified name: e.g. MyNamespace.MySubNameSpace.UserData
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
ok found the issue. I had quantified the datasourcetype name and forgot to drop a letter. I have the folder DataWrappers, however the system wanted to only see: DataWrapper.UserData. I had DataWrappers.UserData and it didn't like that.
|
|
|
|
|
Hi All,
I m using Gios PDF Library for converting my DataTable data into PDF format. Is it possible to convert DataGrid into PDF format. There is one class "pdfGrid" into that Library, but i cant understand how to implement this. Can anyone plz help me, how can I implement this?
The URL is:
http://www.codeproject.com/cs/library/giospdfnetlibrary.asp[^]
I m using .net 1.1 with C#.........
Thanks , Waiting for reply........
|
|
|
|
|
We are looking at implementing a chat software in our website. Any suggestion/recommendation on chat products.
Jamal
|
|
|
|
|
Hi there,
You can do a quick search from CP...there are some ajax chat software out there..
<< >>
|
|
|
|
|
I have a problem I have inserted an formview control to my aspx form. I want to update the record shown in the form view without accessing the editItemTemplate.
How can I do that?
BiG RaLpH
|
|
|
|
|
In my opinion you shouldn't be doing any form of database access on an ASPX form. You should be creating a DAL to handle database interaction.
|
|
|
|
|
Hi,
I am displaying image in html image control without runat=server. The image src is set runtime by some condition, I am using server script for setting image src. This works fine in IE. But it it does not displaying image into Mozilla. I have dibugged the code the function for setting the Image src had called.
Naresh Patel
|
|
|
|
|
N a r e s h P a t e l wrote: The image src is set runtime by some condition, I am using server script for setting image src. This works fine in IE. But it it does not displaying image into Mozilla. I have dibugged the code the function for setting the Image src had called.
So what we can do without seeing a sample code ? Is your image tag refers from root like /images/imagename.gif or it refers like ~/images/image.gif ? If your image tag is not runat server then you can remove ~ ( if you are using ).
|
|
|
|
|
string _ReturnUrl;
public string SetImage1(bool _Active)
{
if (_Active)
{
_ReturnUrl = Server.MapPath("../images/button-green.gif");
}
else
{
_ReturnUrl = Server.MapPath("../images/button-red.gif");
}
return _ReturnUrl;
}
and accesing in grid view Like
" />
Naresh Patel
|
|
|
|
|
N a r e s h P a t e l wrote: _ReturnUrl = Server.MapPath("../images/button-green.gif");
To show image in browser, no need of Server.MapPath() . This gives exact location to the image. We need only virtual path. So try removing Server.MapPath
|
|
|
|
|
Server.MapPath gives you the physical address of the file on the server. That is useless to the browser, and the only reason that it may work at all is if you are browsing on the same computer that is acting as a server.
Just remove Server.MapPath.
---
single minded; short sighted; long gone;
|
|
|
|
|
Thanks yaar for helping:
I got solution:
" />
Naresh Patel
|
|
|
|
|
Hai,
i have a problem i want to show my error message in a div field that placed in the master page ..
public void SetError(string errorMessage)
{
divErrorMessage.InnerHtml = errorMessage;
}
ok. then each page if something have to show then i call like'
(this.Master as View_pages_MasterPage).SetError(CustomResourceManager.ReadResourceName("Resx_ViewDamageReport_StatusUpdation_ErrorMsg"));
here the error message will come...
what i want is i want to show that div only error is come means once i set some error message in that div otherwise that div will be invisible...because div has some background color...
please give me some help..
alex.
|
|
|
|
|
i want to add image or logo beside my titlt page
some thin like this
i want this tag include text and image also
<title >my image+Home</title>
and the finale result is showing in the title bar in the browser
image + home
i hope u understand me
and thank's in all cases
Kareem Elhosseny
|
|
|
|
|
Please don't repost questions so soon. It's considered rude and clutters up the forums. People will respond in their own time.
Paul
|
|
|
|