|
hi,
I am doing a Project (in ASP.NET using C# ) in which i have to display a Message Box ,after clicking on a button .I have used a MesterPage and i want a javascript message Box .I mean in the following case:
button_Save_click()
{
.....Other code ...
//after completion of above code,Message should be displayed..
message("Data is Saved...");
}
i Want all these in Java Script(and asp.net using C#). Also it should be as simple as possibe,and as soon as possible.
also a confirmation box in which after clicking on Delete button,It should ask "do u want to delete" if yes do this...else do this...
Please do help me..soon
expecting early reply of anbody..
|
|
|
|
|
For javascript message box ,Do as following
Register the javascript code as below in the button_Save_click() function after saving the data(i e last line in thios function)
string strMsg="data Saved";
Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowMessage", "alert('" + strMsg+ "');", true);
For confirmation box
You use confirm instead of alert and if its true then delete else not as
<input id="btnSave" style="display:none" type="Button" value="Save" onclick="javascript:var blnValid = SaveDataAfterValidation(); if(!blnValid){return;}" onserverclick="SaveData_Click" runat="server"/>
Here SaveDataAfterValidation(); is a javascipt function showing the confirmbox
Cheers!!
Brij
|
|
|
|
|
hi, Thanks for the reply.
as per u say i have tried the below code for a message:
string strMsg="data Saved";
Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowMessage", "alert('" + strMsg+ "');", true);
Although the above code display a messaagebox but still the background page does not display, instead it displays only a blank and new page,then a message box display.
I mean a message box should be displayed on the same page from where it is called.
wating for the positive response.
|
|
|
|
|
I think you must be doing something wrong.Ahter this,the messagebox will be displayed ,when you click on ok then the page will be loaded.If some another page is coming.Check it with URL, for the page name.
And tell me where you have written this piece of code?
Can you write step by step,what you have done on the page for this functionality?
Cheers!!
Brij
|
|
|
|
|
refer following link
[^]
this will help u for Javascript CONFIRM
regards
koolprasad2003
If the message is useful for U then please Rate This message...
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
hi,
I am doing a Project "Message Board" in ASP.NET using C#. I have to display sticky post first. i Mean how to sort so that sticky post should be displayed first..I mean the topics or post which are posted by a person 10 or more than times.
If posts are 10 or more than 10 then should be displayed first in the data grid as well as sorting should be as per the last modified also.
how will it be possible.
please send me a simple code.. or query
|
|
|
|
|
This all you can get using database query from DB applying all the conditions as you said.and then bind the result to the datagrid .Please check the result from DB whether ,it is correct or not.
Cheers!!
Brij
|
|
|
|
|
Hey, can you guys help me out with this real quick?
I have 2 projects (in 1 solution, both .net 3.5) they are ZZZ.Objects and ZZZ.WebUI, the ZZZ.WebUI project contains a reference to ZZZ.Objects. ZZZ.Objects is a class library project, and ZZZ.WebUI is an asp.net web application project
I created a new class file in the objects project, it contains (and of course the using, namespace, etc...)
public class User<br />
{<br />
public string FirstName { get; set; }<br />
public string LastName { get; set; }<br />
}
Then in the Web Application I created a file (test.cs) and I put this exact code in it.
using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Web;<br />
using ZZZ.Objects;<br />
<br />
namespace ZZZ.WebUI<br />
{<br />
public class Test1<br />
{<br />
User myUser = new User();<br />
}<br />
}<br />
I can't set any properties for myUser! It just pops up with nothing in intellisense, and errors if I try to compile with it manually typed. What is going on?? If I try to instantiate the User Class from a file inside the objects project it works fine! Please help
|
|
|
|
|
I think ,You must've added the refence of that class library project.There is namespace problem.Try with using full namespace at the tome of creating the object as
ZZZ.Objects.User myUser = new ZZZ.Objects.User();
Cheers!!
Brij
|
|
|
|
|
Hmm...Still doesn't work when I try using the full namespace.
Yes, I added the reference to the class library project in my webapp project.
Here is the exact code...
In Project ZZZ.WebApp.Objects - File User.cs
using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Text;<br />
<br />
namespace ZZZ.WebApp.Objects<br />
{<br />
public class User<br />
{<br />
public string FirstName { get; set; }<br />
public string LastName { get; set; }<br />
}<br />
}<br />
In Project ZZZ.WebApp.WebUI - File Test1.cs
using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Web;<br />
using ZZZ.WebApp.Objects;
<br />
namespace ZZZ.WebApp.WebUI<br />
{<br />
public class Test1<br />
{<br />
ZZZ.WebApp.Objects.User myUser = new ZZZ.WebApp.Objects.User();<br />
myUser.
}<br />
}<br />
|
|
|
|
|
Arcdigital wrote: ZZZ.Objects is a class library project
Arcdigital wrote: ZZZ.WebUI is an asp.net web application project
Did you add , ZZZ.Object as Reference to the ZZZ.WebUI
In WebUI , Right Click on reference -> Add Reference-> Go to Project Tab -> Now add ZZZ.Object Class Library.
cheers,
Abhijit
|
|
|
|
|
|
You need to skip the specified number of lines after reading the each line, and the number of lines to skip may vary. correct? I have simulated this with lists, you can change it to your own file reading code.
List<string> list = new List<string>(new string[] { "One", "Two", "Three", "Four", "Five", "six", "seven" });
int linesToSkipAfterEachRead = 1;
int linesSkippedCurrently = linesToSkipAfterEachRead;
for (int i = 0; i < list.Count; i++) {
if (linesSkippedCurrently == linesToSkipAfterEachRead) {
Console.WriteLine(list[i]);
linesSkippedCurrently = 0;
}
else
linesSkippedCurrently++;
} Note, I haven't compiled this as I don't have VS installed. But IMO, this should work.
|
|
|
|
|
hi
iam using visual studio 2005.here iam trying to place login controls.when i hit the "asp.net configuration" to create the users and roles its is not allowing me to create the user.when iam trying to enter userid, password,e-mail,faovorate colour etc.., it is showing the error called " Password length minimum: 7. Non-alphanumeric characters required: 1."please can anyone help me
thanx
valli
|
|
|
|
|
You must supply at least one symbol (non-alphanumeric character) in your password
You can change this behavior by editing the "providers" section of your web.config file:
minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1"
Lars Brandt MCP/C#
|
|
|
|
|
I am not finding "provider" section in web.config file
|
|
|
|
|
You need to override the default complexity requirement (residing in the machine.config) by adding the following code to your web.config file. Then change the values to fit your preferences:
<membership>
<providers>
<remove name="AspNetSqlMembershipProvider" />
<add name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="LocalSqlServer"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
applicationName="/"
requiresUniqueEmail="false"
minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
passwordAttemptWindow="10"
passwordStrengthRegularExpression="" />
</providers>
</membership>
Lars Brandt MCP/C#
|
|
|
|
|
Thank you so much for the help.it is working great.
bye
valli
|
|
|
|
|
hi my friends,
i have some html pages, that pages are work according to userquery string.
if id=1 then 1.hmtl is coming.
Question is that:
how i can set that on an page with web user control (acsx)?
or any option?
Thanks
|
|
|
|
|
By putting the content in user controls and then putting those controls inside one control that decides which inner control to show based on the querystring/
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi,
I just start learning to write web service using C# vs 2005 - I have a question about passing objects between client and web service.
I have a simple XML, I call it ValueTable.xml
<?xml version="1.0" encoding="utf-8"?>
<ValueTable xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="TableA">
<Table>
<Table_rec>
<date>
<cal_date>01/22/08</cal_date>
<weekday>Y</weekday>
</date>
<value>198700</value>
</Table_rec>
<Table_rec>
<date>
<cal_date>01/22/08</cal_date>
<weekday>Y</weekday>
</date>
<value>25500</value>
</Table_rec>
</Table>
</ValueTable>
I ran
xsd valueTable.xml
xsd /n:TableA /c valueTable.xsd
Then I added valueTable.cs generated in my web service project and create a web method -
[WebMethod]
public ValueTable HelloWorld2()
{
ValueTable t1 = new ValueTable();
XmlSerializer si = new XmlSerializer(typeof(ValueTable));
TextReader r = new StreamReader("f:\\ValueTable.xml");
t1 = (ValueTable)si.Deserialize(r);
r.Close();
return t1;
}
I saved the wsdl in my localhost default directory and create a client winform project.
Add the web reference by adding the wsdl and call Helloworld2
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
localhost.Service ls = new localhost.Service();
localhost.HelloWorld2ResultTableTable_rec[][] vt = new ConsoleApplication2.localhost.HelloWorld2ResultTableTable_rec[10][];
vt = ls.HelloWorld2();
}
}
}
vt populates what I expect to see - good (though I am not sure I am doing it the right way).
but say if I want to change HelloWorld2 to be
public ValueTable HelloWorld2(ValueTable Tablein)
by adding an input parameter, for simplicity reason same type of object as the return,
I struggle to get it work. How can I use the info in the wsdl(only)to serialize a ValueTable oject? Do I need to add the same .cs as i did in the server? (does not sound right). Any links or help is appreciated.
|
|
|
|
|
ok, I think I got a problem with decorating, should be fine now, later.
Thanks
|
|
|
|
|
Hi Everybody,
I need to store a datatable in my page (To bind a grid again after Sorting To be precised)
At present I am storing it in viewstate
My question is will it better to store it in session rather than ViewState(As that Datatable is quite big the page may become quite heavy)???
|
|
|
|
|
Yes, I will suggest you to store data table in Session , rather than View State as you data size is quite big.
Any way you can check one of my article on view state
Beginner's Guide to View State[^]
And don't forget to read Discussion Section [ViewState Vs Session ]
cheers,
Abhijit
|
|
|
|
|
hi Abhijit,
read the article ...
good one
thanx
|
|
|
|