|
Liang, have a look at the section "Points Of Interest" (the article you are refering). It is mentioned that if you want to connect to the database you will have to use Databinding.
If you want the ID of the Item, you will have to use the way I mentioned earlier. In the section "Points Of Interest", its specified.
Cheers,
|
|
|
|
|
Hi RepliCrux,
Been quite busy lately, only now I remember to put a reply here.
I got it working though, it seems the way the article said, the ID is already in the listbox, so when I pass the item to another listbox, the ID is already there and here is how I capture all the ID.
for (int i = 0; i < this.lstToUser.Items.Count; i++)
{
if (this.lstToUser.Items[i].Selected == false)
{
this.lstToUser.Items[i].Selected = true;
userlist.Add(this.lstToUser.SelectedValue);
this.lstToUser.Items[i].Selected = false;
}
else
{
userlist.Add(this.lstToUser.SelectedValue);
this.lstToUser.Items[i].Selected = false;
}
}
By giving a command to the list box to select one by one every item in the list and add it into the list item by using this.lstToUser.SelectedValue since the value is suppose to be holding the IDs, then I'll deselect it and select the next one.
But before this we need to do
for (int i = 0; i < this.lstToUser.Items.Count; i++)
{
this.lstToUser.Items[i].Selected = false;
}
To deselect everything in the list box before starting to capture the ID.
This might look strange but at least it works for the mean time
J Liang
|
|
|
|
|
i want to open javascript function in codebehind .
but it open on cell_click event.
pls help me urgently.
gayatri
Gayatri
|
|
|
|
|
niki_nilu wrote: i want to open javascript function in codebehind .
What do you mean ? Opening javascript FUNCTION in code behind ?
|
|
|
|
|
my code is
private void Page_Load(object sender, System.EventArgs e)
{
fpAnaAssgn.Attributes.Add("onClick", "window.ShowDialog()");
}
but i want this code in fpAnaAssgn_CellClick
private void fpAnaAssgn_CellClick (object sender, FarPoint.Web.Spread.SpreadCommandEventArgs e)
{
Response.Write(" { window.ShowDialog() }");
}
but i is not working.
Gayatri
|
|
|
|
|
did u give the url or pagename
for example,
response.write("{window.showdialog(url,"window")}")
|
|
|
|
|
I tried you code and got error. Then I replaced showdialog with open. and it worked for me. But if you have pop up blocker installed, you need to click holding Ctrl key.
|
|
|
|
|
i didn't understand your code.
pls explain it.
because i am beginner in asp.net
Gayatri
|
|
|
|
|
What I mean is when clicking hold control key and click.
|
|
|
|
|
Hi guys
I have a usercontrol on my page and I want to refresh that Usercontrol. When any postback event is fired from the PAGE....
Any idea...
|
|
|
|
|
wEb GuRu... wrote: I want to refresh that Usercontrol. When any postback event is fired from the PAGE....
I think it will reload automatically
|
|
|
|
|
Thanks for ur time Navaneeth.
Actualy I want to refresh usercontrol for certain postback events(NOT FOR EVRY POSTBACK)...
Any idea abt tht???
|
|
|
|
|
Could you tell me the scenario where you will use this ?
|
|
|
|
|
Well I have a UserControl containing "Unsold Ads of a customer" in a label. I have used this control through out the customer account area.
Now when customer mark an Ad as "Sold"(from Datagrid in page) then label displaying Unsold Ads should be refreshed to show only unsold ads.
|
|
|
|
|
If Customer keeps browser idle also do you want to change it ? If so you can make use of some AJAX concepts. If customer refreshes the page , I think your left menu also will update.
|
|
|
|
|
Hello to everyone,
i'm trying to compare the value entered in the text box (Current Password field ) by the user to the valuse given in databse.
initially i did by makin another textbox which is not visible in the page and then used compare validator to compare the given value against original value...
Can any body suggest me any simple method..
|
|
|
|
|
hemant_garg wrote: initially i did by makin another textbox which is not visible in the page and then used compare validator to compare the given value against original value...
This is not a good method. A person who is viewing the source can easily get the value stored in hidden field. I suggest you to do this in server side rather than going for validators. Connect to db and check the password is correct. If not display a message. Don't allow user to complete the process untill both passwords are same
|
|
|
|
|
|
hello hemant,
just try to use the data reader and try to fetch the values from the database then compare the
values like
if (textbox1.text = dr("BLAHBLAH") then
msgbox("Equal")
end if
regards,
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
Hi guys, I need a help please
In my asp.net 2 pages, when I disable some controls on page, user can run some javascript code in address bar that enables my disabled controls, that will cause un-needed results
for example
A gridview that lists exams with a checkbox for each exam, when at least one student has launched an exam, I disable its checkbox so that instructor cannot delete it
Now how can I prevent user from running javascript code from address bar to enable that checkbox, then delete exam
|
|
|
|
|
You should NEVER rely on javascript for anything. You CANNOT disable it. Anything that is selected via javascript, MUST be validated on the server side before performing any actions.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Christian Graus wrote: You CANNOT disable it. Anything that is selected via javascript, MUST be validated on the server side before performing any actions.
Then what will be the use of javascript if we are rechecking everything in server before processing ? Or is it possible to identify javascript is supported by the browser or not ? If not supported then validate it on server. What do you say ? Please make me clear
|
|
|
|
|
Navaneeth. wrote: Or is it possible to identify javascript is supported by the browser or not ? If not supported then validate it on server
Thats not the point that was made. The point is that the client (and any javascript methods) cannot be trusted. As was the original question, a user with some javascript know-how can manipulate the form.
The point of javascript is to make things easier for the user, like disabling the check boxes so its obvious they can't use them, rather than waiting for a postback only to be told they did something wrong. Javascript should be used to enhance the users experience of an site/application, but should never be relied upon for security.
|
|
|
|
|
I tend to check data at every boundary of the application.
I check that what the user put into my page is good.
I then check that what the page submitted to ASP.Net is good.
my ASP code then uses my Business Logic Layer which checks that the data it receives is good.
I don't specifically check that the data entering the database is good but i do have rigorous constraints set up on all databases and I make sure that only objects written by my team have direct writeable access to the DB. I also know that those objects have been repeatedly unit tested before they are released.
You can never check data enough in my opinion especially if those data may have been submitted by an external actor beyond your control. eg web user, public webservice, contract developer. This approach may be bordering on the paranoid but it makes applications far more stable especially as the type of checking that occurs at each level is likely to be different and therefore catches a different set of errors that may occur.
Russ
|
|
|
|
|
Hey people, I think you didn't understand me
I have a button - for example - on my web form
In some cases I disable this button by server side code, no problem
Now my question is:
Can any user openning this page execute javascript code from browser's address bar to enable that button??
And if yes, how can I prevent user from doing that??
|
|
|
|