|
TarDuk wrote: System.Drawing.Image image = RetrieveImage(id, tname);
image.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
Assume you have the byte array in b[] . Response.BinaryWrite(b); ?
|
|
|
|
|
private System.Drawing.Image RetrieveImage(string id,string tname)
{
System.Drawing.Image image = null;
strcon = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"];
Con = new SqlConnection(strcon);
Con.Open();
Cmd = new SqlCommand("SELECT imgimage FROM latework where imgid='" + id + "'", Con);
Cmd.CommandType = CommandType.Text;
SqlDataReader Dr = Cmd.ExecuteReader();
if (Dr.Read())
{
byte[] imageData = (byte[])Dr[0];
MemoryStream memStream = new MemoryStream(imageData);
image = System.Drawing.Image.FromStream(memStream);
}
return image;
}
This is my code to retrive an Image ok now can u do something?
Thanks
|
|
|
|
|
TarDuk wrote: if (Dr.Read())
{
byte[] imageData = (byte[])Dr[0];
MemoryStream memStream = new MemoryStream(imageData);
image = System.Drawing.Image.FromStream(memStream);
}
return image;
}
Replace this with
byte[] imageData = (byte[])Dr[0];
Response.ContentType =
Response.BinaryWrite(imageData)
TarDuk wrote: private System.Drawing.Image RetrieveImage(string id,string tname)
If this function is in your page, make it as void. If it is in a class, you won't get access to Response object until you pass it to the class
|
|
|
|
|
Thanks a lot
N a v a n e e t h I will try with that code and tell u later ok thanks again.
|
|
|
|
|
All job is done in asp.net 2.0
I have a link in main page to open a popup window, in which I have a gridview filled with data from database. Now the prob is, how can I access the hole gridview from the popup to the main page, the main page is already opened. I want the popup to close as I want to go to the main page with gridview from the popup.
The popup is opened using javascript.
Regards
Tutul Biswas
|
|
|
|
|
you want the gridview of the main page to popup . if yes just pass the condition as u fill the gridview on the main page and fill that same in popup.
Devjit Das
|
|
|
|
|
Tutul Biswas wrote: as I want to go to the main page with gridview
Take gridview in your hand and go to main page.
Tutul Biswas wrote: how can I access the hole gridview from the popup to the main pag
No need to access hole gridview.
just store dataset in session and use in main page
bEst rEgard
pAthan
please don't forget to vote on the post that helped you.
|
|
|
|
|
If I do so using response.redirect then the main page will open into popup.
But I want the popup will close and the gridview will transfer to main page.
Regards
Tutul Biswas
|
|
|
|
|
hi friends
How to delete or clear the data grid value in asp.net,At the time of post Back
|
|
|
|
|
Do you mean that Datagird retains the Data during post-back which you don't want?
Regards - J O H N -
|
|
|
|
|
yes frnd
thnx for advance
|
|
|
|
|
If the Viewstate is enabled then the DataGrid will persist the Data during postback. if you want to clear the DataGrid then set the Datasource property to Nothing and do a DataBind.
DataGrid.DataSource = Nothing<br />
DataGrid.DataBind()
Regards - J O H N -
|
|
|
|
|
frnd
i wrote this code in form load
DataGrid1.DataSource = Nothing
DataGrid1.DataBind()
but not working.if i refresh the form the old data also added with new data.
plz give some other solution
|
|
|
|
|
I guess this is the only way to clear the DataGird. How is it possible to display the Old Data when you set the DataSource property to Nothing ?. I guess there is something terribly wrong with your system. How about this alternative...
DataGrid1.Visible = False
If this alternate is also not suitable for you requirement then just put a breakpoint in each event and function in your page and do a step-wise execution and try to trace and fix the problem.
Regards - J O H N -
|
|
|
|
|
hi frnd
DataGrid1.Visible = False
or
datagrid1.datasource = nothing
datagrid1.databind ()
these coding is working i not deny that, but if u refresh the form the old data also coming, ur coding is tempraverly hide the data not deleting the data, plz give some other solution.
|
|
|
|
|
I really couldn't get what exactly the problem is....
ps.srinivasan wrote: the old data also coming
What do you mean by this? There is nothing called old data or new data in DataGrid. Whatever Data that you Bind to the DataGrid will be shown. Did you try to trace the Code?
ps.srinivasan wrote: ur coding is tempraverly hide the data not deleting the data
Are you talking about page caching?
Regards - J O H N -
|
|
|
|
|
many many thnx frnd
ur code is working
"datagrid1.datasource=nothing
datagrid1.databind()"
this code is working perfectly,i declared DATASET variable in global, so that time is not worked,that is mine mistake,thnx for replay,
|
|
|
|
|
Just refresh ur grid as the condition u like. u will immediately get ur desire result.
Devjit Das
|
|
|
|
|
sorry frnd i dont know how to refresh data grid in asp.net plz give idea.
|
|
|
|
|
Just use the condition which u bind with grid or use to delete grid row. which one u like or easy for u.
Devjit Das.
|
|
|
|
|
creating permission to a particular role manager to access a page .the roles will be created by user and how he set to access a .aspx page using c#.that means in webcofig file we can set rol;es to acces a particular page to a role manager.if an afministrator creates a user and set permision to access a page.how is it possible
|
|
|
|
|
i am not able to see the user id. When i debugged it Page.User.Identity.Name was returning null string.
What is actually the problem. What should i do to get rid of it.
Pandi
|
|
|
|
|
What is the authentication mode here?
Regards - J O H N -
|
|
|
|
|
hi iam using two dropdown lists in my application.one dropdownlist filled with database in pageload.the second dropdown list can fill by select index change of the first dropdownlist using ajax.here the values are displayed .but after selection of the value it will be disappear.how can i show selected value in dropdownlist in asp.net
plz help asap.
regards
venkat
|
|
|
|
|
Are you just usng AJAX, or relying on the Microsoft AJAX library ? When does the value disappear ? Odds are high that when you do a postback, the values, which were not in viewstate, will be lost. You should populate the second list based on the selected index of the first list during a postback.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|