|
s2 in stop 2 and 3 contains the TextBox id .
I cannot understand whats the problem.
Is the problem can be due to Masterpage.But my all textbox control are in content place holder and i am not using any control from master page.
|
|
|
|
|
Have a look in view source and see what the textbox id really is, then adjust your code accordingly.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi,
I have a small doubt that, i want to create 3 seperate projects for 3 layers for my small web application. In that i dont want to place my BAL and DAL in the App_Code folder but i want to manage 3 seperate layers. So how to do that? Can anyone explain about it.
Its urgent please let me know.
|
|
|
|
|
Samiullah wrote: i dont want to place my BAL and DAL in the App_Code folder
Why not? Its the correct place for them.
Samiullah wrote: Its urgent please let me know.
Only for you, nobody else cares.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
It should be Simple , First Create a Website and add a new Project "Class" DAL and another "Class" BLL and you havea Separate Layers , see how i do it
http://www.codeproject.com/KB/vb/N-Tier_Application_VB.aspx[^]
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Just make a Class Library type project for a layer (define class and function inside it) except UI layer.Add there's dll in the UI layer and use them.
Cheers!!
Brij
|
|
|
|
|
i have a grid view and it has an ID column when i set the ID column visible = false that cell has no value and its empty and if i set the visible = true that cell has value how can salve this problem?
|
|
|
|
|
i have a GridView and radiobutton in that grid view.i want to get the ID's of grid view row that i selected . how can i access to this id?
|
|
|
|
|
Gridview has a property , GridView1.SelectedRow u can use this.
|
|
|
|
|
i have a grid view and it has an ID column when i set the ID column visible = false that cell has no value and its empty and if i set the visible = true that cell has value how can salve this problem
So if i use selected row i dont have any value in it?
|
|
|
|
|
I was wondering how I could draw in a Panel. If I create a Panel like
Panel panel = new Panel();
panel.Width = 1000;
panel.Height = 750;
this.Controls.Add(_panel);
In Windows Forms, I could call the PaintEvent but there is no PaintEvent in asp.net is there? So how do I draw lines and such on a web Panel? Also the Panel control in the windows forms has a location property but the Panel web control does not? How do I specify a location then?
For a windows form I would do something like:
Panel panel = new Panel();
panel.Paint += new PaintEventHandler(panel_Paint);
private void panel_Paint(object sender, PaintEventArgs e)
{
// Create a graphics object for the _panel.
Graphics _g = e.Graphics;
Pen pen = new Pen(Color.Black);
_g.DrawLine(pen, 10, 10, 20, 20);
}
How can I draw in a Web Panel like this?
|
|
|
|
|
In web everything is rendered into HTML. Thus when you are using a panel, it will be rendered into a div.
So, if you want to draw anything, you need to dynamically draw them into a bitmap, and then will need to show the bitmap in the web page.
You can look into the code snipped below on how to draw custom images during page render.
private void CreateHorizontalTextImage(string pstrText)
{
float sngFontSize = 7.5f;
Font objFont;
int intImageHeight = 18;
int intImageWidth = 60;
objFont = new Font("Courier", sngFontSize);
using (System.Drawing.Bitmap bitmap = new Bitmap ( intImageWidth, intImageWidth ))
{
using (System.Drawing.Graphics g = Graphics.FromImage(bitmap))
{
System.Drawing.SizeF objSizeOfTextAsSizeF = g.MeasureString(pstrText, objFont);
float sngWidthOfText = objSizeOfTextAsSizeF.Width;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
Rectangle rect = new Rectangle(0, 0, intImageWidth, intImageHeight);
System.Drawing.SolidBrush objBlackBrush = new System.Drawing.SolidBrush(Color.Brown);
g.DrawString(pstrText, objFont, objBlackBrush, 0,2);
}
using (System.IO.MemoryStream objStream = new System.IO.MemoryStream())
{
bitmap.Save(objStream, System.Drawing.Imaging.ImageFormat.Gif);
using(System.Drawing.Image img = System.Drawing.Image.FromStream(objStream))
{
System.Drawing.Bitmap b = new System.Drawing.Bitmap(img.Width, img.Height);
using(Graphics gx = Graphics.FromImage(b))
{
gx.DrawImage(img, new Point(0, 0));
}
SaveGIFWithNewColorTable(b, 16, true);
}
}
}
}
protected void SaveGIFWithNewColorTable(
System.Drawing.Image image,
uint nColors,
bool fTransparent
)
{
if (nColors > 256)
nColors = 256;
if (nColors < 2)
nColors = 2;
int Width = image.Width;
int Height = image.Height;
Bitmap bitmap = new Bitmap(Width,
Height,
PixelFormat.Format8bppIndexed);
ColorPalette pal = GetColorPalette(nColors);
for (uint i = 0; i < nColors; i++)
{
uint Alpha = 0xFF;
uint Intensity = i*0xFF/(nColors-1);
if ( i == 0 && fTransparent)
Alpha = 0;
pal.Entries[i] = Color.FromArgb( (int)Alpha,
(int)Intensity,
(int)Intensity,
(int)Intensity );
}
bitmap.Palette = pal;
Bitmap BmpCopy = new Bitmap(Width,
Height,
PixelFormat.Format32bppArgb);
{
Graphics g = Graphics.FromImage(BmpCopy);
g.PageUnit = GraphicsUnit.Pixel;
g.DrawImage(image, 0, 0, Width, Height);
g.Dispose();
}
BitmapData bitmapData;
Rectangle rect = new Rectangle(0, 0, Width, Height);
bitmapData = bitmap.LockBits(
rect,
ImageLockMode.WriteOnly,
PixelFormat.Format8bppIndexed);
IntPtr pixels = bitmapData.Scan0;
unsafe
{
byte * pBits;
if (bitmapData.Stride > 0)
pBits = (byte *)pixels.ToPointer();
else
pBits = (byte *)pixels.ToPointer() + bitmapData.Stride*(Height-1);
uint stride = (uint)Math.Abs(bitmapData.Stride);
for ( uint row = 0; row < Height; ++row )
{
for ( uint col = 0; col < Width; ++col )
{
Color pixel;
byte * p8bppPixel = pBits + row*stride + col;
pixel = BmpCopy.GetPixel((int)col, (int)row);
double luminance = (pixel.R *0.299) +
(pixel.G *0.587) +
(pixel.B *0.114);
*p8bppPixel = (byte)(luminance * (nColors-1)/255 +0.5);
}
}
}
bitmap.UnlockBits(bitmapData);
this.Response.Clear();
this.Response.ContentType = "image/gif";
bitmap.Save(this.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif);
Response.End();
BmpCopy.Dispose();
bitmap.Dispose();
}
protected System.Drawing.Imaging.ColorPalette GetColorPalette( uint nColors )
{
PixelFormat bitscolordepth = PixelFormat.Format1bppIndexed;
ColorPalette palette;
Bitmap bitmap;
if (nColors > 2)
bitscolordepth = PixelFormat.Format4bppIndexed;
if (nColors > 16)
bitscolordepth = PixelFormat.Format8bppIndexed;
bitmap = new Bitmap( 1, 1, bitscolordepth );
palette = bitmap.Palette;
bitmap.Dispose();
return palette;
}
Abhishek Sur
|
|
|
|
|
How can I add a bitmap to a panel?
|
|
|
|
|
Just set the
Style="background-image:url('path');"
of the panel....
otherwise you can append one Img tag to the panel, and then set the src to the bitmap.
Abhishek Sur
|
|
|
|
|
can any one give me the idea how to check the mouse double click event in javascript for asp.net...
|
|
|
|
|
there is an event onDblclick on Body. U may use that .. but note Double clicks itself generates a Onclick event.
Abhishek Sur
|
|
|
|
|
actually i am using datalist and i want to check the items present in it is single click or double click when clicked on it...
|
|
|
|
|
you need to call the javascript to the control within it for those particular events...
Abhishek Sur
|
|
|
|
|
hi all,
can you please help me in Creating of gridviewrowdatabound Event using Model-View-Presenter Pattren.
Thanks And Regards,
Guru
|
|
|
|
|
Hi All
How to change an image/icon in datagrid when a button (External/outside tha datagrid) is clicked.
let be more precise..
Here I am Using Template Column to do Edit , Update and Cancel Actions.
when i click on AddNew Row Button..The datagrid displays a new blank row along with Update and Cancel Icons(including tooltips).But I need to change Update Icon to Insert Icon..
How Can this be done???...
I have tried with following code...
Dim enable As ImageButton = DirectCast(StatusGrid.FindControl("btnUpdate"), ImageButton)
enable.ImageUrl = "<img border = 0 src = ./Icons/add.jpg>"
enable.ToolTip = "Insert"
but I got "Object reference not set to an instance of an object." error
Please Guide...
Thank you.
|
|
|
|
|
Call the FindControl function on the row which is assigned to insert. The code should be like this.
DirectCast(StatusGrid.Rows[Row Index].Cells[Column Index].FindControl("btnUpdate"), ImageButton)
|
|
|
|
|
Hi Kannan,
Thanks for your reply...
I tried with that code, but i am getting error as
"Rows is not member of System.Web.Ui.WebControls.Datagrid"
please Suggest..
Thanks
|
|
|
|
|
Thanks Kannan,
I Got It.
|
|
|
|
|
how can i add datafield value
if my column coming from database name "status" and 0,1 bit values are coming..
i want to place in datafield=if status=0 then "disable" else "active"
how is it possible ???
umerumerumer
|
|
|
|
|
try this , may be this can help . first fill gridview with Data .
for(int i=0;i<gridview1.rows.count;i++)>
{
// first find that field
lable status = (Lable)(GridView1.rows[i].FindControl("lblstatus"));
int st = Convert.ToInt(status.text);
if(st==0)
{
status.visible=false;
}
else
{
status.visible=true;
}
}
|
|
|
|