Showing posts with label table. Show all posts
Showing posts with label table. Show all posts

Monday, March 26, 2012

Please Help - me

Hi there
I have a table which contains all the sub folders for my drop down menu...
when the mouse goes over the menu, the sub folders are displayed,
the problem is that the sub menu tables are displayed behind everything
else...
How can i change it to be displayed on Top'
thanks
AdamPC@dotnet.itags.org.hotmail.comUse the CSS style z-index.
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.
"ACaunter" <AdamPC@.hotmail.com> wrote in message
news:6489CE5A-EA20-41C2-BC4D-AE09A269795C@.microsoft.com...
> Hi there
> I have a table which contains all the sub folders for my drop down menu...
> when the mouse goes over the menu, the sub folders are displayed,
> the problem is that the sub menu tables are displayed behind everything
> else...
> How can i change it to be displayed on Top'
> thanks
> --
> AdamPC@.hotmail.com

Please Help - me

Hi there
I have a table which contains all the sub folders for my drop down menu...
when the mouse goes over the menu, the sub folders are displayed,
the problem is that the sub menu tables are displayed behind everything
else...

How can i change it to be displayed on Top??
thanks

--
AdamPC@dotnet.itags.org.hotmail.comUse the CSS style z-index.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"ACaunter" <AdamPC@.hotmail.com> wrote in message
news:6489CE5A-EA20-41C2-BC4D-AE09A269795C@.microsoft.com...
> Hi there
> I have a table which contains all the sub folders for my drop down menu...
> when the mouse goes over the menu, the sub folders are displayed,
> the problem is that the sub menu tables are displayed behind everything
> else...
> How can i change it to be displayed on Top??
> thanks
> --
> AdamPC@.hotmail.com

Saturday, March 24, 2012

Please Help Datagrid Columns

I have a table called Computers with 8 colunms.

I have a select query that list out the Computer brand and the price.
what I want is that when I click on the computer brand then the respective information about this brand will be display in the same page or open a new page. I am using a datagrid, how do I make this work? or should I use other component like table.
Please helpIf you have unique Identifier for the Computerband table use it to create a hyperlink column in the datagrid. then pass the id as querystring. During the postback event read the Id get the details of the brand form from the id and then you can display that in formation in a panel below this grid.

Note;
1. AutoGenerateColumns property must be set to False
2. Manually Create DataGrid columns including the hyperlink column

Ex:


<asp:DataGrid id="dg1" AutoGenerateColumns="False" runat="server">
<asp:HyperLinkColumn Headertext="Brand Id" DataTextField="BrandId" DataNavigationUrlField="BrandId" DataNavigationUrlFormatString="ComputerBrands.aspx?brandId={0}" />
<asp:BoundColumn DataField="ComputerBrandName" HeaderText="Brand Name"/>
<!-- .... add other columns -->
</asp:DataGrid

Thanks
Thank you Jay.

I still have som problem, I create a procedure that reads
Create Proc GetComputerID

@.ComputerID int

as
Select Computer,Price,CPU from Computers
Where ComputerID = @.ComputerID

I do not know where to pass the parameter in the grid, and I could not type computerID={0}
vb.net would not even allow me to run the application
I removed the where claus from my statement. But when I click on the hyperlink, nothing happens.
Here is the ASP code:
<asp:HyperLinkColumn Text="Computer" Target="_self" DataNavigateUrlField="ComputerID" DataNavigateUrlFormatString="UsedComputer.aspx?ComputerId={0}"
DataTextField="Computer" HeaderText="Computer" NavigateUrl="Computer"></asp:HyperLinkColumn>
<asp:BoundColumn DataField="Price" HeaderText="Price"></asp:BoundColumn>
<asp:BoundColumn Visible="False" DataField="ComputerID" HeaderText="ComputerID"></asp:BoundColumn>
</Columns>

Please help Friends how to control maxlength textbox in datagrid

Is there a way to set the maxlength property for a text box in the datagrid.

My database table field size is only 10 chars for first name.

How can i make the user not to enter more tha 10 chars on the front end.

Is there any Max length property i can assign for the text boxes.

I have 4 text boxes in datagrid.

Thank you very much.Hi,

if it is single-line TextBox, you can use its MaxLength property like you normally can.

<asp:TextBox ID="xxx" MaxLength="4"... /
This works even if TextBox is in a DataGrid.
Thanks Joteke, I have the following code triggered when i click edit in the datagrid, then it will show all text boxes etc. where can i place the maxlength="4" property in the following code.

Thank you very much.

< Code >
Sub MyDataGrid_UpdateCommand(s As Object, e As DataGridCommandEventArgs )
Dim conn As SqlConnection
Dim MyCommand As SqlCommand
Dim strConn as string = "server=Rajender;uid=sa;pwd=sa;database=NORTHWIND"
Dim txtFirstName As textbox = E.Item.cells(2).Controls(0)
Dim txtLastName As textbox = E.Item.cells(3).Controls(0)
Dim txtTitle As textbox = E.Item.cells(4).Controls(0)
Dim strUpdateStmt As String
strUpdateStmt =" UPDATE Employees SET" & _
" FirstName =@.Fname, LastName =@.Lname, Title = @.Title " & _
" WHERE EmployeeID = @.EmpID"
conn = New SqlConnection(strConn)
MyCommand = New SqlCommand(strUpdateStmt, conn)
MyCommand.Parameters.Add(New SQLParameter("@.Fname", txtFirstName.text))
MyCommand.Parameters.Add(New SQLParameter("@.Lname", txtLastName.text))
MyCommand.Parameters.Add(New SQLParameter("@.Title", txtTitle.text))
MyCommand.Parameters.Add(New SQLParameter("@.EmpID", e.Item.Cells(1).Text ))
conn.Open()
MyCommand.ExecuteNonQuery()
MyDataGrid.EditItemIndex = -1
conn.close
BindData
End Sub

</ code >
In that case, you could declare EditItemTemplate for the DataGrid (declaratively in asox) in which you set the TextBox's MaxLength.

If you want to do it programmatically, then you'd do it in ItemDataBound method (when ItemType is EditItem)

Wednesday, March 21, 2012

please Help me find out a way!

I want a client to enter a 'key' in a textbox and click a button. then the entered value will be used to search a table in the MS-SQL database. The corresponding value found from that table will be used to search a second table. Data found from the second table will be bounded to the datagrid control at the page where the client entered the 'key'. What will be the way to achieve this? What will be the SQL command??

I'm not sure if I'm able to describe the problem. I'm a new user of ASP.NET. So please help.

Ishtiaque.

A stored procedure like this will work:

CREATE PROCEDUREdbo.Example
@.key1varchar(255)
AS
DECLARE@.key2varchar(255)
SELECT@.key2 = key2columnFROMTable1WHEREkey1column = @.key1
--The select below will return your results so you can bind to your grid:
SELECT*FROMTable2WHEREkey2column = @.key2


Thank you Sharbel_.

I made a stored procedure as you suggested and used it by a 'drag and drop' method in my webform. But as I mentioned I am a novice user of ASP.NET, could not utilize the sqlConnection or sqlCommand that resulted of doing so. Would you please let me know how to do so?

Thanks in advance.


Hi,

using System.Data.SqlClient; at the top in the .cs file

Create the connection and the command objects in the page_load or in the button click as

SqlConnection sqlcn =new SqlConnection(connectionString);

sqlcn.Open();

//creating and initialising a command object

SqlCommand sqlcm =new SqlCommand();

sqlcm.Connection = sqlcn;

sqlcm.CommandType = CommandType.StoredProcedure;

sqlcm.CommandText = StoredProcedure name;

sqlcm.ExecuteNonQuery();

HTH.