Monday, March 26, 2012
Text in Image, Question
<%@dotnet.itags.org. Page Language="c#"%>
<%@dotnet.itags.org. Import Namespace="System.Drawing.Imaging" %>
<%@dotnet.itags.org. Import Namespace="System.Drawing" %>
<%@dotnet.itags.org. Import Namespace="System.Drawing.Drawing2D" %>
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Bitmap bmp= new Bitmap(Server.MapPath(Request.QueryString["i"]));
Graphics g=Graphics.FromImage(bmp);
g.SmoothingMode = SmoothingMode.AntiAlias ;
g.DrawString(Request.QueryString["t"],
new Font("verdana",12),SystemBrushes.WindowText, 1, 1);
Response.ContentType="image/jpeg";
bmp.Save(Response.OutputStream, bmp.RawFormat) ;
}
</script>
I have tried adding in stuff and changing stuff, but I just can't do it!
All I want to do is change the font color to white
Thanks in advanceg.ForeColor = Color.White
Tuesday, March 13, 2012
TextBox = database call. How?
I am reasonably competent at creating SqlDataSources, DropDownLists, GridViews etc. but I am drawing a blank as to how a TextBox would make a call to a SqlDataSource. Can a TextBox have a data source? How do you construct the code behind to execute a call to a database and then load a field value into the TextBox. Something like below?
protectedvoid DropDownList1_SelectedIndexChanged(object sender,EventArgs e)
{
lblCCG_ID.Text =Convert.ToString(DropDownList1.SelectedValue);
- - - run call to database - - - Select Field3 Where Field6 = @dotnet.itags.org.CCG_ID;
TextBox1.Text = Eval("Field3");
- - -
}
Yes you can databind a TextBox but not like GridView or DataList for e.g. here is one way to do it.
//Declaratively - assume LoadValueFromDB() is a code behind method to retrieve data returns a string
//Instead of LoadValueFromDB method you could databind using a Datasource e.g. a custom object e.g. Order.OrderTotal.ToString()
<asp:TextBox id="Text1"Text="<%# LoadValueFromDB()%>"Width="200px"runat="server"/>Also see thishttp://www.developerfusion.co.uk/show/4410/5/
Well you can call the db value at the text box text as:
text='<%# DataBinder.Eval(Container.DataItem, "commentID") %>' Well you can call the db value at the text box text as:text='<%# DataBinder.Eval(Container.DataItem, "commentID") %>'