|
This article[^] details how to retrieve an image from a database.
Basically, you create an aspx page called something like LoadImage.aspx.
The LoadImage.aspx page contains the code to get the image from the database (the aspx page content doesn't matter as it gets replaced by the image data).
private void ShowImageData(byte[] imageData)
{
Response.Clear();
Response.ContentType = "image/jpeg";
Response.OutputStream.Write(imageData, 0, imageData.Length);
Response.End();
}
Then in you web page where you want to display the image, you just put a link to the image: e.g. where the imageID is the image id in the database to load. This would be accessed in the Page_Load of LoadImage.aspx
ChrisB
|
|
|
|
|
|
Is it possible to display checkbox value in display like first,next...buttons.
watever the value it has that sholud display using any background color for that perticular value...or any other idea.
I need to display the checkbox valued also in record navigation.
Thanks in advance
kissy
|
|
|
|
|
Hi all
Some body help me
I am building a project by ASP.Net (VS2005) Framework 2.0
I have use GridView, When i use GridView have Datasource = SqlDataSource so VS2005 support
afterthat i add CommandFiel is "Edit, update, cancel" and use Event "GridViewUpdateEventArgs"
void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string[] strValues = new string[3];
int i = 0;
foreach (DictionaryEntry entry in e.NewValues)
{
strValues[i] = Server.HtmlEncode(entry.Value.ToString());
i = i + 1;
}
}
When i use GridView have "Datasource = SqlDataSource" so strValues[i] have value
but when i dont use "SqlDataSource" so i get data to database by
string strQuery = "Select * from Categories";
SqlConnection connect = new SqlConnection(strConnection);
SqlDataAdapter da = new SqlDataAdapter(strQuery, connect);
DataTable dt = new DataTable();
da.Fill(dt);
GridView1.DataSource = Datatable;
GridView1.DataBind();
strValues[i] haven't value and it not run to loop "foreach"
I want get value to gridview and update to database don't use SqlDataSource so by command
|
|
|
|
|
Hi there,
This is one of the advantages of using the DataSource control, that said the NewValues dictionary is only populated when you use the GridView control with a datasource control like the SqlDataSource. So in your case, you need to manually get the new values from the input controls in the edit row of the gridview like you did with the datagrid control in the old days.
|
|
|
|
|
|
Hello,
Can anybody show me how I will going to make a log-in page that will use Active Directory for authentication.
I really appreciate your help. Thanks in advance.
-- modified at 5:20 Thursday 5th October, 2006
|
|
|
|
|
|
Hi...thanks for your help but do you have any idea if I want to authenticate all users with different domain controller? without setting any userid and password?
Our scenario is we have different domain controller. We want to have a web page log-in that will have different access depending on the domain they will log. Our Active Directory ID password is reset every month and I only have an access to only one domain so I cannot use configuration with user id and password parameter.
Thanks for your help again in advance.
|
|
|
|
|
Hi
given below code is to display searched records.
problem is that it displays correctly in only first page.
when i click next.it displays all records.
such as if would search job:Developer and country:USA.
it displays correctly in only on first page.when i click on next. it displays all records from all country and all job.
please help me out
string jobs = txtjob.Text;
string jobsdesc = ddcoun.SelectedValue ;
string sqlstmt = "select * from employer_eng where ( job LIKE '%" + jobs +"%' or job_desc LIKE '%" + jobs +"%' ) And cou_name_ar='" + jobsdesc + "'" + " "+ "And" + " " + "approval='Y'";
SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["DBConnection"]);
SqlCommand cmd = new SqlCommand(sqlstmt ,conn);
conn.Open();
//conn.Open();
//DataGrid1.DataSource = cmd.ExecuteReader(CommandBehavior.CloseConnection);
//DataGrid1.DataBind();
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataSet ds=new DataSet();
sda.Fill(ds);
PagedDataSource pgds1 = new PagedDataSource();
pgds1.DataSource = ds.Tables[0].DefaultView;
pgds1.AllowPaging = true;
pgds1.PageSize = 10;
int CurPage;
if (Request.QueryString["Page"] != null)
CurPage=Convert.ToInt32(Request.QueryString["Page"]);
else
CurPage=1;
pgds1.CurrentPageIndex = CurPage-1;
lblsearch.Text = "Page: " + CurPage.ToString();
if (!pgds1.IsFirstPage)
searchp.NavigateUrl=Request.CurrentExecutionFilePath
+ "?Page=" + Convert.ToString(CurPage-1) + "&j=" + jobs + "&d=" + jobsdesc;
if (!pgds1.IsLastPage)
searchn.NavigateUrl=Request.CurrentExecutionFilePath
+ "?Page=" + Convert.ToString(CurPage+1) + "&j=" + jobs + "&d=" + jobsdesc;
repsearch.DataSource = pgds1;
repsearch.DataBind();
cmd.Dispose();
conn.Close();
|
|
|
|
|
|
hi dear
i need to construct a regular expression by using which i can restrict user to only enter value which is prefixed e.g.
i need to construct a regular expression to accept only one value between three 'input_1','input_2','input_3'...
hope u got that.
waiting for a postive reply
regards
vishal
regards
Thanks & Regards
Vishal Sharma
vishalsharma556@yahoo.co.in
|
|
|
|
|
I don't have an answer, but I can give you some hints to get you started, you can download the Expresso[^] with the tutorials posted here at CP.
|
|
|
|
|
Hi,
I wish to implement the PostBack to the Same Page, BUT with Different Data Values. (I am Passing the Data in URL).
When i click on some server control (for ex Anchor,LinkButton & <a href=""> ), the URL need to be modified immediately.
For example, I m having 10 pages numbered 1,2,3,..10 (conside each page no as any one Navigation control), and when i clicked on the no 1, immediately the URL's page value need to be changed to 1. Like this for all page no. BUT before the PostBack occurs.
xyz.aspx?page=1
B'Coz, in my Page_Load event handler i wish to get that page value using Request.QueryString["page"] .
How to achieve this? Which CONTROL i have to use for PostBack to occur to the same page WITH modified URL value?? OR any other solution for this?
Regards,
Jay
|
|
|
|
|
u can initialize the page variable on the first page Page_Load and then increment and decrement that variable depending on what u need
as for the postback thing ... i'm not sure about it
Best Regards
3ala2
|
|
|
|
|
Hi,
Thanks for your suggestion. But i have to SET the Page value in URL only, B'coz it has used for many other purposes in the aspx Page.
Now i have used LinkButton Control and set its PostBackUrl property in the Page_Load event handler.
string pageIndex= Request.QueryString["page"].ToString();<br />
LinkButtonID.PostBackUrl= "Products.aspx?&page="+pageIndex;
The thing is that, i have to check for Page.IsPostBack in the Page_Load.It works fine. Previously my problrm is that, i have set it in the Click event handler of each LinkButton.
-- modified at 0:19 Friday 6th October, 2006
Regards,
Jay
|
|
|
|
|
I have a button in one page,when i clicked on that button,a pop window will open,in that popup i have a text area,ok,cancel buttons,i want to give the input to the textarea and click ok button,the popup willclose automatically,and comes to the first page click button function
Meanwhile the firstpage server execution stops when the popup is called
How to stops the firstpage server execution and starts automatically when the popups ok button clicked
Thanks&Regards
Srilakshmi
|
|
|
|
|
Why do you want the main to stop working? What does it do when you open the pop-up window? IMO, you may simply use the showModalDialog method to pop up the window and while he's working on this pop up he cannot access the main page.
|
|
|
|
|
i am using a webservice in which a method is serach. i use this method which accept a argument of date type in dd/MM/yyyy formate. i have a textbox which accept the date from the user, when i convert textbox data into Datatime formate it converted into MM/dd/yyyy formate, but i have a requirement in dd/MM/yyyy formate of date type.
please help me, i am using c#.Net 2003
-- modified at 0:29 Friday 6th October, 2006
|
|
|
|
|
|
i have try this:
string selectedLanguage = "en-GB";
UICulture = selectedLanguage ;
Culture = selectedLanguage ;
Thread.CurrentThread.CurrentCulture =
CultureInfo.CreateSpecificCulture(selectedLanguage);
Thread.CurrentThread.CurrentUICulture = new
CultureInfo(selectedLanguage);
System.IFormatProvider format =
new System.Globalization.CultureInfo("fr-FR", true);
string stringDate = "23/03/05";
DateTime DTddMMyyyy=DateTime.Parse(stringDate,format,System.Globalization.DateTimeStyles.None);
the format of DTddMMyyyy is MM/dd/yyyy and
i want it in dd/MM/yyyy as 23/03/2006. but the result should be in
datetime data type.
if i use datetime.tostring("dd/MM/yyyy") then it returns strinng type
date. but i want the return type be datetime object not string/
i am using web service which take date in datetime format and in
"dd/MM/yyyy" format. but in .Net the date type return or change or default
format is "MM/dd/yyyy". so plz help me to find the solution. this phaze is
final phase of my project and there i change ne thing like change in
service provider then it effect my whole project so plz help me
Ashutosh Kumar
|
|
|
|
|
There are a couple of things that you might want to check when you run your code in debug mode and step through your code line by line:
+ You can check the DateTimeFormatInfo value at run time especially when the DTddMMyyyy object does not have the right format:
+ You can check the DTddMMyyyy object after the Parse method executes.
Below are two examples that give me the correct DateTime object after the Parse method runs:
string selectedLanguage = "en-GB";
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(selectedLanguage);
string stringDate = "23/03/05";
DateTime DTddMMyyyy = DateTime.Parse(stringDate);
string selectedLanguage = "en-US";
CultureInfo culture = new CultureInfo(selectedLanguage, true);
culture.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy";
Thread.CurrentThread.CurrentCulture = culture;
string stringDate = "23/03/05";
DateTime DTddMMyyyy = DateTime.Parse(stringDate);
|
|
|
|
|
dear friend,
i want to get the user's loginid in to my VB / ASP applications.
can anyone please help.
you may please throw some light on various ways of getting this info.
we are having Windows server 2003 domain and
as soon as a user logs into the domain using Windows Authentication,
i want to run a service to get his loginid & proceed with other tasks.
thanks
|
|
|
|
|
Are you asking the classic ASP? Though this is the ASP.NET room, but you can have a look at the server variable LOGON_USER ( or AUTH_USER ) from the Request object. For more information, see server variables[^]
|
|
|
|
|
Try (ASP.NET C#)
User.Identity.Name.ToString()
or
string user = HttpContext.Current.User.Identity.Name.ToString();
user = user.Substring(user.LastIndexOf("\\") + 1);
Hope this help.
|
|
|
|