|
Hi,
Are you using UpdatePanel?
Thanks,
Rajdev KR
|
|
|
|
|
|
I have done pretty much the same thing. I ended up using a little jscript. I call it with the "true" or "false" that I want the item to have.
function applyvalidate(myenableflag) {
document.all.validate.disabled = true;
if (myenableflag == true) {
document.all.validate.disabled = false;
}
if (myenableflag == false) {
document.all.validate.enabled = false;
}
}
The name of the button is "validate". I do this so that the person has to have a valid form (actively check with jscript) and when it is valid, the validate button lights up. they can then hit the validate button that provides a code for entry into a checklist. Then I light up the submit button.
At anytime when the formcheck becomes invalid, i use the same functions to disable the buttons on the fly.
Does that help?
|
|
|
|
|
ya it does help. thanks a lot.
|
|
|
|
|
Glad it helped. I can't even remember how and where I stumbled across that... allowed me to do a TON of client side automation on forms. Probably NOT the best solution, but in specific areas, it works well...
|
|
|
|
|
<br />
Response.Clear()<br />
Response.AddHeader("Content-Disposition", "attachment; filename=" & fileName)<br />
Response.ContentType = "application/octet-stream"<br />
Response.TransmitFile(FullFilePath)<br />
Response.End()<br />
with this code i am unable to open the downloaded files, if browser is FireFox.
|
|
|
|
|
I have a Calendar Extender/JavaScript Calendar[I tested Both] in a TextBox control. There is another TextBoxcontrol below this one. When the Calendar pops up, it is over the lower TextBox and the text and header from that TextBox are showing up over the Calendar. Is there a way to make sure the Calendar is always on top?
|
|
|
|
|
See if it supports z-index
|
|
|
|
|
hey there, I'm still learning C# and am having some issues with a login I've created. The login page gets the user info into an object and sets the cookie no problem. But when I go to the next page I can't seem to figure out how to get at the object I created on the login page. Here's a snippet of what I've got...
login.aspx.cs
private void cmdLogin_ServerClick(object sender, System.EventArgs e)
{
UserDetails oUserDetails = validateUser(txtAssocNum.Value, txtUserName.Value, txtUserPass.Value);
if (oUserDetails != null)
{
Response.Cookies["UserID"].Path = "/";
Response.Cookies["UserID"].Value = oUserDetails.UserID.ToString();
FormsAuthentication.RedirectFromLoginPage(txtUserName.Value, chkPersistCookie.Checked);
}
else {
lblMsg.Text = "The information you provided does not match our database.";
}
}
loadDetailsAfterLogin.aspx.cs
protected System.Web.UI.WebControls.Panel PanelMain;
private void Page_Load(object sender, System.EventArgs e)
{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
if (!User.Identity.IsAuthenticated)
{
Response.Redirect("~/Login.aspx");
}
UserDetails oUserDetails = new UserDetails();
PanelMain.Controls.Add(new LiteralControl("<table>"));
PanelMain.Controls.Add(new LiteralControl("<tr><td>First Name : </td><td>" + oUserDetails.FirstName + "</td></tr>"));
PanelMain.Controls.Add(new LiteralControl("<tr><td>Last Name : </td><td>" + oUserDetails.LastName + "</td></tr>"));
PanelMain.Controls.Add(new LiteralControl("</table>"));
oUserDetails = null;
}
Thanks in advance.
|
|
|
|
|
liamderice wrote:
First Name : " + oUserDetails.FirstName + "
Last Name : " + oUserDetails.LastName + "
oUserDetails does not exist on this page, therefore you can't access it.
I suggest you learn some OO and C# first, then move on to ASP.NET.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I had wondered that, but thought there might be a fancy new way of keeping the state of an object between pages in c#. Thanks.
|
|
|
|
|
There are ways, but they're neither fancy nor are they new.
I suggest that you google
Asp.net request.querystring
Asp.net session
Asp.net Page State
for the most common methods to pass data between pages.
|
|
|
|
|
Jorgens answer is correct. I'll just add - user info should go in the session, but for anything else, I'd write pages that load data from the db using a value on the querystring.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Yeah, I'm used to doing this kinda thing with classic asp, but thought there might be something different as I moved to c#. Thanks for the advice guys.
|
|
|
|
|
|
Hi All,
I've been grappling with this for a few days now, and am no further forward, here's the scenario:
I have a page that contains the following
linqDataSource : productListDS (Selects * from products table)
GridView : gridProductList (Data source is productListDS)
linqDataSource : productDetailDS (Selects * from products table where id == id)
DetailsView : detailsProduct (Data source is productDetailDS)
The gridview lists all the products in the data source, with paging and select button enabled, when the select command is clicked the details view is then updated to show all the fields of the selected product and has the 'Edit', 'Insert' and 'Delete' commands enabled.
The gridView ONLY shows 5 columns from it's data source (The AutoGenerateColumns option is false) and i'm constructing the colums manually in the columns tag. I have the DataKeys set to id, and when i click the select button everything works flawlessly.
My problem comes when i do an Insert/Delete/Update.
As an example if i add a new record by putting the details form into insert mode, fill in the fields and then click insert, it inserts the record into the underlying SQLServer database, but the gridview does not update.
I've tried doing a 'gridProductList.DataBind()' in the page load, and in the details view 'ItemInserted' event, and still no luck. If however i browse away from the page, and then back the gridView then displays the newly added products. Even pressing F5 to force an update does not work, in fact all that achieves is to resubmit the last insert and add another new record to the DB.
The linq Data SOurce is connected to a LInqToSql DBML class.
Does anyone have ANY ideas on how to force the Grid View to update and show the table changes made using the details view without having to browse away from the page and then browse back.
Cheers
Shawty
|
|
|
|
|
pingpingpong wrote: I've tried doing a 'gridProductList.DataBind()' in the page load,
Page load runs before your events. So, you're binding before the insert. This is why browsing away and back works. Do your databinding in page prerender, always.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Thanks Christian,
I'll look into that, one more question...
Does ths even apply when i'm not doing the original databinding manually, i'm just letting the datasource/datagrid sort it out them selves. Calling the DataBind() proc just seemed like a sensible thing to try to force it to update.
|
|
|
|
|
Christian, thanks.... that worked excellently.
|
|
|
|
|
sir,
Just to encrypt a string, i used this code.
code:
public string encryptText(string plaintext,string passpharse,string saltValue,string hashAlgorithm,int passwordIterations,string initvector,int keysize)
{
byte[] InitVectorBytes = Encoding.ASCII.GetBytes(initvector);
byte[] saltValueBytes = Encoding.ASCII.GetBytes(saltValue);
byte[] plaintextbytes = Encoding.ASCII.GetBytes(plaintext);
PasswordDeriveBytes password = new PasswordDeriveBytes(passpharse, saltValueBytes, hashAlgorithm, passwordIterations);
byte[] keyBytes = password.GetBytes(keysize / 8);
RijndaelManaged symmetricKey = new RijndaelManaged();
symmetricKey.Mode = CipherMode.CBC;
ICryptoTransform encryptor = symmetricKey.CreateEncryptor(keyBytes, InitVectorBytes);
MemoryStream memorystream = new MemoryStream();
CryptoStream cryptostream = new CryptoStream(memorystream, encryptor, CryptoStreamMode.Write);
cryptostream.Write(plaintextbytes, 0, plaintextbytes.Length);
cryptostream.FlushFinalBlock();
byte[] ciphertextbytes = memorystream.ToArray();
memorystream.Close();
cryptostream.Close();
string ciphertext = Convert.FromBase64String(ciphertextbytes);
return ciphertext;
}
I've got the following errors:
Error 1 The best overloaded method match for 'System.Convert.FromBase64String(string)' has some invalid arguments.54,29
Error 2 Argument '1': cannot convert from 'byte[]' to 'string'.54,54
Please help me to resolve it.
|
|
|
|
|
You've declared ciperTextBytes as a byte array, when it needs to be a string.
ConvertFromBase64String(string) is telling you that you need to pass the parameter to it as a string data type.
I'm not 100% sure with out testing it, but
string ciphertext = Convert.FromBase64String(ciphertextbytes.ToString()); !!MIGHT!! work.
Cheers
Shawty
|
|
|
|
|
|
You need to describe it better than that i'm afraid.
the .ToString()??? the function??? the routine??? try to convert your byte array to a string before hand. It's fairly easy.
All you need to do is iterate through the array collection and convert each byte to a char before adding it to a string.
Cheers
Shawty
|
|
|
|
|
Sir,
please explain it in detail
|
|
|
|
|
There's not much to it.
You just need to declare a string, make it empty :
String [myvariablename] = ""
then you just need to loop over your byte array :
foreach(byte [mybytevariablename] in [mybytearrayname])
then in the loop just concatenate each element.
[myvariablename] = [myvariablename] + [mybytevariablename]
When your finished, then the string you defind should be a string of all the chars in your byte array which you can then pass to the function.
replace the [..] above as appropriate for your variable names where you've defined them.
|
|
|
|