|
The ASP.NET forum is the place for ASP.NET questions. Why would anyone assume from your original post that this was an ASP.NET question ?
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 )
|
|
|
|
|
Sorry, but this question is releated about image processing. Accually, all question releated about .NET classes, so all question move to .NET framework message board. Isn't it ???
Best Regard...
|
|
|
|
|
No, this question has absolutely nothing to do with image processing.
1 - drawing on an image is not image processing, and
2 - your question is how to pass an image you have created in memory into a web page, right ? That's an ASP.NET question. Rendering it in a winforms app is both trivial, and completely different. That's why all the initial answers you got were useless to you. And that's my point. I don't care where you ask, there is some crossover, a lot of questions in the ASP.NET forum *are* C# questions. But, asking this question in this forum has meant it's taken you longer to get towards an answer, as people assumed you were asking something different.
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 )
|
|
|
|
|
Actually If I use oBitmap.Save(Response.OutputStream, ImageFormat.Jpeg); so image created without physically. But how to initialize Image1.ImageUrl = "??????".
Best Regards...
|
|
|
|
|
There are two ways to do this:
1 - with a HTTPHandler that passes back the image
2 - by saving the image to your file system first.
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 )
|
|
|
|
|
Christian Graus wrote: There are two ways to do this:
1 - with a HTTPHandler that passes back the image
2 - by saving the image to your file system first.
Or perhaps the most obvious:
3 - with a page that passes back the image
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
using System;
public class AvgPrime
{
public static void Main()
{
double c=0,y=0,p=0;
int i,j;
bool isPrime;
for(i=2; i <= 100; i++)
{
isPrime = true;
for(j=2; j <= i/2; j++)
{
if(i % j == 0)
{
isPrime = false;
}
}
if(isPrime)
{
y = y + 1;
c = c + i;
}
}
p = c/y;
Console.WriteLine("The avg of all prime numbers from 1 to 100 is {0}",p);
}
}
|
|
|
|
|
Oh come on, if this isn't homework, what else is?
Some people never learn...
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
How about adding some explanatory text lines that start with a double slash?
Things I would like to know:
- why are c and y of type double?
- why is i incremented by one?
- why is j limited to i/2?
- why does the for(j) loop continue when a divisor has been found?
- why are most identifiers single-character?
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
|
i am working on compiler......i want to know the details about lexical analysis......is there any code avaliable which performs lexical analysis ofC++ or c#
waiting for reply
thanks
|
|
|
|
|
Lexer in C#, or for C# (in C++)? If the latter suffice, take a look at Shared Source Common Language Infrastructure[^]
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
I have a button called AddItem so i want whenever the button is got
clicked new row shud be inserted on the table forexample when page is
loaded there is no any row when user click the button one row shud be
added when second time he clicks another row shud b inserted in the
table control but the problem is at first time it inserts the row bt
whn i click second time no row is inserted it shows only one row no
matter how many times u click the button.
I have addRow method in button click event which adds the row in the
table when called. this situation is in c#.
Actually i can make this in javascript but the problem is javascript
cant create server side controls for example asp:textbox nd so on . i
need to access the controls in each row through c# code so i cant
achieve all the objectives in javascript.
I hope u got understood wht the prob is..
I just want there shud be a function like addRow which adds the row in
table when it is called in C# code
any help will be greatly appreciated
Aftab Ali Shaikh
|
|
|
|
|
You have to update the viewstate after adding the control. Have look at this[^].
Right now on every postback your page is loosing the previously added controls that's why it add only single row every time you click the button. You might have to have some counter for the clicks.
-----
|
|
|
|
|
thanks for the replay SABhatti
u r right its loosing information on every post i did refered the example u told bt same is happening over here can u give me some example in coding form a very simple example one button and textbox when u click button textbox shud b added every time u click the button new textbox shud b added
any help will be greatly appreciated
thanks in advance
|
|
|
|
|
Well ShaikhAffi, I have not tried anything like this but quickly I can give you one idea (there are definitely other ways too but right now I can give you this which will definitely work).
keep a hidden field or session variable, every time user clicks the button increase that field by 1 (on the server side not on the client) now in page load do this:
<br />
if(!IsPostBack)<br />
preserveControls()<br />
<br />
protected void preserveControls()<br />
{<br />
int noOfControls = (hiddenfield.Value.Length > 0) ? (int)hiddenfield.Value : 0;<br />
if(noOfControls > 0)<br />
for(int i=0; i < noOfControls; i++)<br />
{
}<br />
<br />
and in button ClickEvent add the control and increment the hiddenfieldValue by 1
-----
|
|
|
|
|
Well Thank u very much for ur reply bt i this solution wont b suitable for my prob coz in each row i have atleast 5 textboxes so it will make the problem complecated what do u think
|
|
|
|
|
here is the sample page for exactly what you want:
aspx page (I have added only one template column with text box, but you can add as many as you want):
<asp:GridView ID="gv" runat="server" OnRowDataBound="gvRowDataBound">
<Columns>
<asp:TemplateField HeaderText="test">
<ItemTemplate>
<asp:TextBox ID="tb" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Button ID="btn" runat="server" Text="Add" OnClientClick="javascript:document.getElementById('hf').value='true';return true;" />
<asp:HiddenField ID="hf" runat="server" />
code behind file:
protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
if (Request.Form["hf"] == "true")
addGVRow();
hf.Value = string.Empty;
}
private void addGVRow()
{
DataTable dt = (DataTable)Session["dt"];
int counter = 0;
if (dt == null)
{
dt = new DataTable();
dt.Columns.Add("seq");
}
else
counter = dt.Rows.Count;
DataRow dr = dt.NewRow();
dr[0] = counter + 1;
dt.Rows.Add(dr);
gv.DataSource = dt;
gv.DataBind();
Session["dt"] = dt;
}
protected void gvRowDataBound(object sender, GridViewRowEventArgs e)
{
// hide the last cell (sequence)
e.Row.Cells[e.Row.Cells.Count - 1].Visible = false;
}
I am assuming that first time the page will be blank with add button only.
-----
|
|
|
|
|
Actual SA Bhati i need to add row in table server control not in datagrid
i nedd to add row in existing table the row shud contain atleas 4 to 5 textboxes
hope u understood
well thank u very much for the help
|
|
|
|
|
tell me briefly what your are trying to achieve? I mean what is the resulting output for the user? and and what you want from the user?
-----
|
|
|
|
|
well im working on an application for my father's buisness he has whole sale shop so whn a customer comes he may purchase items obviously he can purchase more than one time so im developing cash memo in tht cash memo ther are four textboxes for the itemName quantity saleprice and total and there is one button name addMoreItem so wht i want when user clicks this button same row of four textboxes shud b added every time user clicks row with the textboxes shud be added.after submitting the form whole data has to be saved in database the problem as i already told u is im unable to dynamically add row in table. hope u understand
|
|
|
|
|
well the solution/sample page I gave you for gridview does exactly the same thing and I'll suggest to use gridview instead of table server control. But, if you want to use table control then you can try the same logic for that.
-----
|
|
|
|
|
well SA Bhatti i tried ur code the prob is u have implemented the session table tht i dont want coz if u will use session table then probably when u come back to tht page it will insert the last no: of rows
|
|
|
|
|
on page load i just equals the session table to null now the problem is solved bt how can i access the each textbox in grid view well thank u very much
i w8 for ur reply
|
|
|
|
|
In aspx page add save button like:
<br />
<asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" /><br />
<br />
in code behind file do this:
<br />
protected void btnSave_Click(object sender, System.EventArgs e)<br />
{<br />
foreach (GridViewRow row in gv.Rows) <br />
{<br />
TextBox tb = (TextBox)row.FindControl("tb");<br />
string valueTyped = tb.Text;<br />
}<br />
}<br />
-----
|
|
|
|