|
try this.
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
}
protected void GridView1_PageIndexChanged(object sender, EventArgs e)
{
GridView1.DataBind();
}
suchita
|
|
|
|
|
thanks for the help, but still i see the same records
|
|
|
|
|
goldsoft wrote: but still i see the same records
Post your code here.
|
|
|
|
|
Hello!
Are there any open source ASP.NET MVC GUIs for users/roles management?
Die Energie der Welt ist konstant. Die Entropie der Welt strebt einem Maximum zu.
|
|
|
|
|
|
Thanks for the link. Yeah, I've already found it. What I want to find is something more complicated, like MyWSAT[^] – but for MVC
Die Energie der Welt ist konstant. Die Entropie der Welt strebt einem Maximum zu.
|
|
|
|
|
I have a checkbox in my page which is autopostback true. If the user clicks on the checkbox,
I want to display a confirmation text box in javascript, and if the user clicks on Ok,
then only the postback should occur, otherwise not. Even though the js is working and
confirmation box displays, no postback is happening.
Below is my code:
Javascript code:
function ReportConfirmation() {
if (confirm("Proceeding with Output File Generation ? ")) {
return true;
}
else {
return false;
}
}
<asp:CheckBox runat="server" ID="chkGenerateRpt" AutoPostBack="true" OnCheckedChanged="chkGenerateRpt_CheckedChanged" Text="Generate Reports"/>
Code-Behind in PageLoad (outside the IsPostBack):
chkGenerateRpt.Attributes.Add("OnClick", "javascript:return ReportConfirmation(); ");
protected void chkGenerateRpt_CheckedChanged(object sender, EventArgs e)
{
if (chkGenerateRpt.Checked)
{
}
}
If i remove return from the pageload code above, the page will work irrespetive of
whether the user clicks on cancel or Ok button in confirmation box? Could anybody
please help in finding out the error?
Thanks in advance
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
I checked the page source and found that: if you enable AutoPostBack for a check box, an onclick handler is automatically attached to the page. Now when you add another onclick event to the page both of them are concatenated and looks like this -
<input id="chkGenerateRpt" type="checkbox" name="chkGenerateRpt" onclick="javascript:return ReportConfirmation(); ;setTimeout('__doPostBack(\'chkGenerateRpt\',\'\')', 0)" /><label for="chkGenerateRpt">Generate Reports</label>
See the bold part. Thus it is not working.
Now how we can overcome this problem:
This thread describes the possible solutions -
http://www.dotnetmonster.com/Uwe/Forum.aspx/asp-net-web-controls/4449/Checkbox-AutoPostBack-JavaScript[^]
I will paste the solution here as well -
1. Manualy create a new checkBox class which derived from the asp.net's
CheckBox control and override the render method so as to insert our own
script before the build in "AutoPostBack" script (__doPostBack)
2. Use the InputCheckBox control in the System.Web.UI.HtmlControls
namespace and we can add a serverchange event for it and also handler its
clientside "onclick" script event. But we need to manually post back the
page when user click it at clientside, for example:
<input type="checkbox" id="chkClient" runat="server" value="..."
name="chkClient" onclick="alert('hello');document.forms[0].submit();"
onserverchange="chkServer_CheckedChanged">
in page's codebehind we have :
protected void chkServer_CheckedChanged(object sender, System.EventArgs e)
{
Response.Write("<br>CheckChanged at: " + DateTime.UtcNow.ToString());
}
I hope this clears your doubt and solves your issue!
Cheers!
Ankur
..Go Green..
|
|
|
|
|
Thank you Ankur. I think the second one is the best option. Thanks a lot !!!
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
I am glad that it helped you.
Cheers!
Ankur
..Go Green..
|
|
|
|
|
sir i need the documentation for the project "SYSTEM INFORMATION DESKTOP TOOL" its urgent sir and it is related to my project so plz send the documentation to my gmail id "inturi143@gmail.com"
its urgent sir
thanking you
|
|
|
|
|
If you need some help on an related article here on CP SYSInfo: System info desktop tool[^] it would be appropriate to leave a message on the board of said article. You can download and study the code and whatever there is, but if you need further assistance you need to contact the author instead of posting it here.
Cheers!
|
|
|
|
|
Hi,
I am creating a new datalist custom control, basicly why I need this solution is that. I will use it in pretty same way with same columns (maybe column names that return is different).
The question is that I am unable to add itemtemplate to this server control... Could you please assist me with the codes and the event name that adds this control.
Thanks in advance
|
|
|
|
|
|
Hi,
thanks for the answer, but what I need is not about the common datalist control, I am creating my own datalist control via web server controls. So I am overwriting some of the common datalist controls' events. I need my datalist control to come with an itemtemplate by default. This itemtemplate will require some fields that will be provided by properties.
There are two events while creating your own control
1. rendercontents
2. createchildcontrols
I was unable to addd itemtemplate by these 2 events.. How could I manage this, I do not know at the moment.
I hope I made myself clear now.
|
|
|
|
|
In addition to thatraja list, see also this[^]
|
|
|
|
|
Hi,
thanks for the answer, but what I need is not about the common datalist control, I am creating my own datalist control via web server controls. So I am overwriting some of the common datalist controls' events. I need my datalist control to come with an itemtemplate by default. This itemtemplate will require some fields that will be provided by properties.
There are two events while creating your own control
1. rendercontents
2. createchildcontrols
I was unable to addd itemtemplate by these 2 events.. How could I manage this, I do not know at the moment.
I hope I made myself clear now.
|
|
|
|
|
Hi,
I need to prevent multiple users updating same record same time and same table ,
i tried with Sq l-transactions ,
every user data updating properly but last user data will be the current data ,
here i need to show alert message for second user onwards.
Please suggest me better way to do this.
Regards,
Vishnu.
|
|
|
|
|
The accepted way to do this is to hold some form of version information on the table (be it an update tickcount, or incrementing number). Retrieve this with your record, and pass it back in when you attempt to update the record. If the version doesn't match on the update, it means that somebody else has updated the record while you were editing it. At this point, you can inform the user that the record has been updated by somebody else.
|
|
|
|
|
|
Try locking access, just flag up if it is currently being accessed and stop further access to it.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
Hi and happy new year to westerns.
I've a website based on ASP.NET 2 and Sql server 2000 as storage. I use FTP for updating website. Site has a administrators part for content management. The site has been hacked twice since a month ago. Records of some of tables gets deleted . These tables are germane to public webpages not secured parts of the site. and besides some photos from website directories gets deleted. When the site was first hacked I scrutinized directories and found some ASP.NET pages with "aspx" extension placed in some directories. I downloaded those files and check them out. With a cursory look I ascertained that those are programs that analyse the security of sites and faciliate hacking.
After the first atack I encrypted my sql server 2000 database user password and placed it in web.config file but the second attack was happened. Site is protected from sql injection attacks.
The shell files were deleted from the website after the first attack.
Some questions arise here :
1. How those files were placed in the website directories by someone ?
2. Is there anyway to avoid such unwanted upload to website ?
3. How is it possible for hacker to access the database while I have encrypted the password in web.config and site
is protected from sql injection attacks.
Any solution is highly appreciated.
|
|
|
|
|
Well my first thought was that you need to check your DB layer for sql injection attacks. You mentioned that your site is protected, so double check that, because maybe you just check some techniques of sql injection hacks, but there are many ways to do it.
Also check your credentials to upload that files in the Server, and maybe you should change them.
luisnike19
|
|
|
|
|
There isn't a one size fits all answer for this (hence the subject line). I'm a little rusty at the security side of things, but the following might be a start:
- Did you change your password when you encrypted it: if not the hacker could still be using your original password.
- You should consider locking down your FTP setup, so that you arrange to have FTP open only when you are uploading. This is most likely how they got in. You could also change your firewall so it only accepts incoming FTP requests from internal/known IPs.
- The presence of files on your site indicates that whoever has hacked you *might* have some level of user access to you machine (ftp is more likely, but there are tools to bootstrap yourself an account using known vulnerabilities) : Check for new users (especially with administrative rights) and strap your server down.
- If the hacker has their own login account, they might no longer need the password, their kerberos identity could be enough if authentication is in mixed mode. Check the SQL logs to see who has been in on your system, again strap down who can log in to your SQL server, but they sound clever enough to cover their own tracks. If your SQL server isn't on a different machine, move it. Only allow specific windows accounts to login (say the DB admin's and yours), or none at all (SQL only mode).
- Put some code security in place so that only code signed by yourselves can be actually executed.
- Change your SQL password again: they may already have a new one.
Securing a website isn't easy, there are several vulnerabilities (tools to get admin access, social engineering etc) and any is a potential route in. If you can't do it yourself you should consider getting someone in who can:- it is a skilled job, but before doing this you need to asses what level of risk is acceptable and how much you are willing to pay to secure your site.
|
|
|
|
|
You might want to engage the services of a penetration tester (a white hat hacker) to identify the weaknesses in your site. Also, analyse your logs for details, and if I were you, I'd get in touch with the police; I assume that hacking is a crime in the country you live in.
|
|
|
|