|
i have this code to upload a file file is upload name is id of the field for unique but now when i go for this folder there is no file type show. i want that if i store .rar than show .rar, if user store .zip show .zip extension, if user store .png show .png how can i do this. plz some one help me? my code is given above plz check is its right or not and what made change to convert like i want. i got file extension but now i would like to know when i show this path in link button how to load client when click on this link plz some one help me in this topic. thanks in advance.
protected void btn_add_issue1_Click(object sender, EventArgs e)
{
DataTable tbl1 = dt.filltbl("select * from tbl_issue where id=-1", "new1");
DataRow row1 = tbl1.NewRow();
row1["issue_id"] = ViewState["max"].ToString(); ;
row1["prefix"] = ViewState["prefix"].ToString();
row1["Project_id"] = Convert.ToInt32(ddl_projects.SelectedValue);
row1["project_name"] = Convert.ToString(ddl_projects.SelectedItem);
row1["issue_title"] = txt_issue.Text;
row1["issue_type"] = Convert.ToString(ddl_issue.SelectedItem);
row1["issue_desc"] = FreeTextBox1.Text;
row1["status"] = "Open";
row1["svdate"] = DateTime.Now.Date.ToShortDateString();
row1["svtime"] = DateTime.Now.ToShortTimeString();
tbl1.Rows.Add(row1);
dt.update(tbl1, "select * from tbl_issue");
fillissueid();
FreeTextBox1.Text = "";
txt_issue.Text = "";
object max = dt.getmax("select max(id) from tbl_issue");
if (fu_attachment.FileName != "")
{
DataTable tblco = dt.filltbl("select * from tbl_issue where id=" + max, "maxx");
DataRow r1 = tblco.Rows[0];
string a = Convert.ToString(max);
string str = "~/Data1/";
str = Server.MapPath(str);
str = str + a ;
fu_attachment.SaveAs(str);
r1["issue_attach"] = "~/Data1/" + a ;
dt.update(tblco, "select * from tbl_issue");
}
Page.RegisterStartupScript("myrest", "<script>alert('New issue was added successfully');</script>");
Response.Redirect("default.aspx");
}
I will do my best?
Integrated Solutions, Bikaner (Raj.), India
modified on Monday, September 29, 2008 10:50 AM
|
|
|
|
|
Hi There,
I would like to know if someone can assist me with the following:
I need to display data in a tabular format, but I would like to group the relevant data together. In the sample below I am using a asp:repeater to populate a table. The select statement in my code behind file would return data from different employees within different companies ordered by the company name. I want to group all employees from one company together and do a basic summary line before starting with the next company i.e. Number of employees found per company.
<asp:repeater id="employeeList" Runat="server">
<HeaderTemplate>
<tr>
<td width="200">
Company ID
</td>
<td width="200">
First Name
</td>
<td width="200">
Last Name
</td>
<td width="200">
Company
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr bgcolor="#ccffff" style="FONT-SIZE: 12px; COLOR: red">
<td><%# DataBinder.Eval(Container.DataItem,"COID") %></td>
<td><%# DataBinder.Eval(Container.DataItem,"FIRSTNAME") %></td>
<td><%# DataBinder.Eval(Container.DataItem,"LASTNAME") %></td>
<td><%# DataBinder.Eval(Container.DataItem,"COMPANY") %></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:repeater>
Regards,
|
|
|
|
|
Hi,
If your data is stored in XML format, you could use XSLT to achieve this. Just in case you are unaware of XSLT, XSLT is an XML based transform language which lets you sort, present, and summarize data which is stored within an XML file.
Here is a useful link for getting started: http://www.xml.com/pub/a/2000/08/holman/index.html?page=1[^]
I hope that this is of use!
Lea Hayes
|
|
|
|
|
Hi guys!
I have had to use quite a lot of AJAX for the website that I am working on, but I am often faced with synchronizing control properties between the client and server. I started thinking about ways in which I could interact with the view state, but there are complexities involved with this (i.e. encryption and compression).
I then realised, what if a second view state were to be constructed for client side use. I could create a JavaScript class which manages this view state, and a base class for all client-side controls which eases interaction with this client-side view state. I figure that the best way to serialize this information is with JSON (I use the JavaScript Prototype Framework for this). I haven't actually created this yet because there is a major problem that I wanted to address.
Somehow I need to intercept the default ASP.NET "__DoPostBack" function so that I can add some serialization functionality for my client view state class.
Any help would be greatly appreciated!
Lea Hayes
|
|
|
|
|
I've been digging around and have just discovered the Page.ClientScript.RegisterOnSubmitStatement method. This method allows client-script code to be injected into the default ASP.NET __DoPostBack method by means of an ASP.NET specific custom event theForm.onsubmit . If the custom client-script code returns false, the post back is aborted.
So, for my particular problem, I can use this functionality of ASP.NET to create a client-side equivalent of the server-side view state.
Best regards,
Lea Hayes
|
|
|
|
|
I want code to autogenerate a 4 digit number without alphabets..in asp.net plz post ASAP........
|
|
|
|
|
There are so many things wrong with this post I dont know where to start... so I wont
The answers posted by me are suggestions only and cannot be used in anyway against me.
|
|
|
|
|
Always look on the bright side of life - At least the subject was more-or-less descriptive.
|
|
|
|
|
LOL!
The glass is half full
The answers posted by me are suggestions only and cannot be used in anyway against me.
|
|
|
|
|
Well,it would be better if you make re-question but with more details.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
string getmaxids;
Random intRandomNumber = new Random();
int x;
x = intRandomNumber.Next(1000, 9999);
getmaxids = string.Format("{0}", x );
MessageBox.Show(getmaxids);
|
|
|
|
|
First of, that's completely wrong. 0001 is a number.
Secondly, stop posting code to do other people's homework. It doesn't help them, it only hinders them.
|
|
|
|
|
Hi If you think it completly wrong than definiely it is...I know that there will be no 0001 if we follow the above code. It's just for the hint not the complete code. Here in discussion I think we get a direction how we have to preceed and moreover the question itself was not clear.
|
|
|
|
|
Please be more specific and detailed
Cheers!!
Brij
|
|
|
|
|
int x = 1234
there you go.
or, if you prefer vb,
dim x as int = 1234
Bob
Ashfield Consultants Ltd
|
|
|
|
|
i have a button and in onclick i wrote this:
Context.Response.Redirect("~/Print.html?ProductName=salam");
i dont know how should i get the parameter ProductName in print.html.
can anybody help me? plz
|
|
|
|
|
You can the value of url by "window.location" then search the values from it.
Cheers!!
Brij
|
|
|
|
|
can you write a sample for me. thanks
|
|
|
|
|
you can use this javascript function
function querySt(ji)
{
hu = window.location.search.substring(1);
gy = hu.split("&");
for (i=0;i<gy.length;i++)
{
ft = gy[i].split("=");
if (ft[0] == ji)
{
return ft[1];
}
}
}
in your case parameter "ji" would be "ProductName" and it will return "salam".
Actually if the URL more than parameter then also it'll work
Cheers!!
Brij
|
|
|
|
|
i wrote this:
<script type="text/javascript" >
function ontextchange(ji)
{
hu = window.location.search.substring(1);
gy = hu.split("&");
for (i=0;i<gy.length;i++)
{
ft = gy[i].split("=");
if (ft[0] == ji)
{
document.getElementById("lblDesc").value =ft[0] ;
}
}
}
onload = ontextchange("ProductName");
</script>
lblDesc is my label but i can not see the value salam
do u know why?
|
|
|
|
|
for value,
use
document.getElementById("lblDesc").value =ft[1] ;
if doesn't work
use alert for ft[0] and ft[1] then check what it shows
Cheers!!
Brij
|
|
|
|
|
|
Hi Friends,
I am using webdatetimeedit of infragistics in my asp.net pplication . I am giving the editorcontrol id of infragistics ultraweb grid control . And the editor control id is the id of webdatetimeedit . But the control is always displaying in the bottom of the page . But in practically the control should not display in any occurance . So could you people help me out regarding this issue . Its pretty urgent .
With Best Regards
Santanu
|
|
|
|
|
patra.santanu@yahoo.co.in wrote: Its pretty urgent
No its not, otherwise you would contact infragistics - after all, its their control so they should be able to help you.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
HI ALL,
I am using the following code for Decrtption
public static string Decrypt(string xxxxx)
{
RijndaelManaged RijndaelCipher = new RijndaelManaged();
string Password = "srinu";
byte[] EncryptedData = Convert.FromBase64String(xxxxx);
byte[] Salt = Encoding.ASCII.GetBytes(Password.Length.ToString());
//Making of the key for decryption
PasswordDeriveBytes SecretKey = new PasswordDeriveBytes(Password, Salt);
//Creates a symmetric Rijndael decryptor object.
ICryptoTransform Decryptor = RijndaelCipher.CreateDecryptor(SecretKey.GetBytes(32), SecretKey.GetBytes(16));
MemoryStream memoryStream = new MemoryStream(EncryptedData);
//Defines the cryptographics stream for decryption.THe stream contains decrpted data
CryptoStream cryptoStream = new CryptoStream(memoryStream, Decryptor, CryptoStreamMode.Read);
byte[] PlainText = new byte[EncryptedData.Length];
int DecryptedCount = cryptoStream.Read(PlainText, 0, PlainText.Length);
memoryStream.Close();
cryptoStream.Close();
//Converting to string
string DecryptedData = Encoding.Unicode.GetString(PlainText, 0, DecryptedCount);
return DecryptedData;
}
It is showing me an error
"An exception of type 'System.FormatException' occurred in .DLL but was not handled in user code
Additional information: Invalid length for a Base-64 char array."
in the Line "byte[] EncryptedData = Convert.FromBase64String(xxxxx);"
Plz help me solve this ASAP.
|
|
|
|