Thursday, March 29, 2012
Please don't laugh
run the following simple command:
DataGrid1.AutoGenerateColumns=False;
But I am presented with error that name "False" does not exist in my class
etc...
Do I need to reference some dll or what?Is it C# or VB.NET if it's C# it's called false not False.
"gale" <srdjan.m@.datagate.net> skrev i meddelandet
news:b9l8ntj1vl03.1svtfcby90pq7$.dlg@.40tude.net...
> Want to configure properties of a datagrid in C# during runtime. I want to
> run the following simple command:
> DataGrid1.AutoGenerateColumns=False;
> But I am presented with error that name "False" does not exist in my class
> etc...
> Do I need to reference some dll or what?
gale <srdjan.m@.datagate.net> typed:
> Want to configure properties of a datagrid in C# during runtime. I
> want to run the following simple command:
> DataGrid1.AutoGenerateColumns=False;
> But I am presented with error that name "False" does not exist in my
> class etc...
> Do I need to reference some dll or what?
Remember that C# is case sensitive. So you should write:
DataGrid1.AutoGenerateColumns = false;
Davide Vernole
MVP ASP/ASP.NET
Microsoft Certified Solution Developer
ignore my question, figured it out...
C# is case sensitive. The keyword is false (rather than False with a capital
letter).
Patrice
"gale" <srdjan.m@.datagate.net> a crit dans le message de
news:b9l8ntj1vl03.1svtfcby90pq7$.dlg@.40tude.net...
> Want to configure properties of a datagrid in C# during runtime. I want to
> run the following simple command:
> DataGrid1.AutoGenerateColumns=False;
> But I am presented with error that name "False" does not exist in my class
> etc...
> Do I need to reference some dll or what?
On Thu, 14 Oct 2004 14:27:53 +0200, gale <srdjan.m@.datagate.net>
wrote:
>Want to configure properties of a datagrid in C# during runtime. I want to
>run the following simple command:
>DataGrid1.AutoGenerateColumns=False;
>But I am presented with error that name "False" does not exist in my class
>etc...
>Do I need to reference some dll or what?
Have you tried:
DataGrid1.AutoGenerateColumns=false;
(c# is case-sensitive)
And that's why I use VB.Net
:)
David Wier
MCP, MVP ASP.NET, ASPInsider
http://aspnet101.com
http://aspexpress.com
"Patrice" <nobody@.nowhere.com> wrote in message
news:O33WNsesEHA.2948@.TK2MSFTNGP12.phx.gbl...
> C# is case sensitive. The keyword is false (rather than False with a
capital
> letter).
> Patrice
> --
> "gale" <srdjan.m@.datagate.net> a crit dans le message de
> news:b9l8ntj1vl03.1svtfcby90pq7$.dlg@.40tude.net...
to
class
>
Please dont laugh
run the following simple command:
DataGrid1.AutoGenerateColumns=False;
But I am presented with error that name "False" does not exist in my class
etc...
Do I need to reference some dll or what?Is it C# or VB.NET if it's C# it's called false not False.
"gale" <srdjan.m@.datagate.net> skrev i meddelandet
news:b9l8ntj1vl03.1svtfcby90pq7$.dlg@.40tude.net...
> Want to configure properties of a datagrid in C# during runtime. I want to
> run the following simple command:
> DataGrid1.AutoGenerateColumns=False;
> But I am presented with error that name "False" does not exist in my class
> etc...
> Do I need to reference some dll or what?
gale <srdjan.m@.datagate.net> typed:
> Want to configure properties of a datagrid in C# during runtime. I
> want to run the following simple command:
> DataGrid1.AutoGenerateColumns=False;
> But I am presented with error that name "False" does not exist in my
> class etc...
> Do I need to reference some dll or what?
Remember that C# is case sensitive. So you should write:
DataGrid1.AutoGenerateColumns = false;
--
Davide Vernole
MVP ASP/ASP.NET
Microsoft Certified Solution Developer
ignore my question, figured it out...
C# is case sensitive. The keyword is false (rather than False with a capital
letter).
Patrice
--
"gale" <srdjan.m@.datagate.net> a crit dans le message de
news:b9l8ntj1vl03.1svtfcby90pq7$.dlg@.40tude.net...
> Want to configure properties of a datagrid in C# during runtime. I want to
> run the following simple command:
> DataGrid1.AutoGenerateColumns=False;
> But I am presented with error that name "False" does not exist in my class
> etc...
> Do I need to reference some dll or what?
On Thu, 14 Oct 2004 14:27:53 +0200, gale <srdjan.m@.datagate.net>
wrote:
>Want to configure properties of a datagrid in C# during runtime. I want to
>run the following simple command:
>DataGrid1.AutoGenerateColumns=False;
>But I am presented with error that name "False" does not exist in my class
>etc...
>Do I need to reference some dll or what?
Have you tried:
DataGrid1.AutoGenerateColumns=false;
(c# is case-sensitive)
And that's why I use VB.Net
:)
David Wier
MCP, MVP ASP.NET, ASPInsider
http://aspnet101.com
http://aspexpress.com
"Patrice" <nobody@.nowhere.com> wrote in message
news:O33WNsesEHA.2948@.TK2MSFTNGP12.phx.gbl...
> C# is case sensitive. The keyword is false (rather than False with a
capital
> letter).
> Patrice
> --
> "gale" <srdjan.m@.datagate.net> a crit dans le message de
> news:b9l8ntj1vl03.1svtfcby90pq7$.dlg@.40tude.net...
> > Want to configure properties of a datagrid in C# during runtime. I want
to
> > run the following simple command:
> > DataGrid1.AutoGenerateColumns=False;
> > But I am presented with error that name "False" does not exist in my
class
> > etc...
> > Do I need to reference some dll or what?
Saturday, March 24, 2012
Please Help Datagrid Columns
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
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 itemcommand event for a datagrid checking wether the field is blank or not
When ever if the date field is blank i want to raise the Jscript, But it does'nt work.
Only with date i have the problem rest all fields work excellent, if they are blank it does show the javascript message.
Following code is used under the itemcommand of the datagrid.
txtid = e.Item.FindControl("eventid_add")
txtdate = e.Item.FindControl("eventdt_add")
txtref = e.Item.FindControl("eventref_add")
If txtid.Text <> "" And txtdate.Text <> "" And txtref.Text <> "" Then
'do this
Else
'javascript popup
Dim AlertScript As String
AlertScript = "<script language='javascript'>" & _
"alert('Event Date and Reference No. are required!')" & _
"</script>"
Page.RegisterStartupScript("AlertScript", AlertScript)
End If
Thank you very much for the information.Try doing this on the OnItemDataBound event. During OnItemCreated the data is not bound to the datagrid yet, so it is not accessible.
And if it still doesn't work, try to access the data in the datasource(still during OnItemDataBound), not the datagrid; (my example is C#, but you should get the picture)
if (DataBinder.Eval(e.Item.DataItem, "eventdt_add" == DbNull.Value) {
//do your thing
}
Please help me how to do this - Urgent
I need to merge some of the rows in the datagrid in asp.net 1.1 with
comma separator.For example i have column name Filed_by which list the
customer's full name.Now i need to merge all the customer name cells
into single cell seperated by comma. Please let me know how can i do
that.Also if you have some example that would be great.
Thanks,
VishnuAssuming you cant merge your values in SQL, you can probably iterate the
dataset / datatable in a loop, pick out the values and glue them together or
you could probably just use a templatecolumn and merge the columns that way
As an iteration example this might get you started:
ArrayList s = new ArrayList();
foreach (DataRow myDataRow in myDataSet.Tables["Customers"].Rows)
{
s.Add(myDataRow["filed_by"].ToString() +
myDataRow["full_name"].ToString());
}
Then bind that to your datagrid as shown here
/url]
Regards
John Timney (MVP)
VISIT MY WEBSITE:
[url]http://www.johntimney.com" target="_blank">http://www.johntimney.com/blog/defa...johntimney.com
http://www.johntimney.com/blog
<settyv@.gmail.com> wrote in message
news:1163098102.821494.319230@.k70g2000cwa.googlegroups.com...
> Hi,
> I need to merge some of the rows in the datagrid in asp.net 1.1 with
> comma separator.For example i have column name Filed_by which list the
> customer's full name.Now i need to merge all the customer name cells
> into single cell seperated by comma. Please let me know how can i do
> that.Also if you have some example that would be great.
>
> Thanks,
> Vishnu
>
Please help me how to do this - Urgent
I need to merge some of the rows in the datagrid in asp.net 1.1 with
comma separator.For example i have column name Filed_by which list the
customer's full name.Now i need to merge all the customer name cells
into single cell seperated by comma. Please let me know how can i do
that.Also if you have some example that would be great.
Thanks,
VishnuAssuming you cant merge your values in SQL, you can probably iterate the
dataset / datatable in a loop, pick out the values and glue them together or
you could probably just use a templatecolumn and merge the columns that way
As an iteration example this might get you started:
ArrayList s = new ArrayList();
foreach (DataRow myDataRow in myDataSet.Tables["Customers"].Rows)
{
s.Add(myDataRow["filed_by"].ToString() +
myDataRow["full_name"].ToString());
}
Then bind that to your datagrid as shown here
http://www.johntimney.com/blog/defa...e3-95c3f29a8a8a
--
Regards
John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog
<settyv@.gmail.comwrote in message
news:1163098102.821494.319230@.k70g2000cwa.googlegr oups.com...
Quote:
Originally Posted by
Hi,
>
I need to merge some of the rows in the datagrid in asp.net 1.1 with
comma separator.For example i have column name Filed_by which list the
customer's full name.Now i need to merge all the customer name cells
into single cell seperated by comma. Please let me know how can i do
that.Also if you have some example that would be great.
>
>
Thanks,
Vishnu
>
Friday, March 16, 2012
Please Help Select Statement Issue
I am trying to use a datagrid to display the data when the user enters a number into a textbox.
Below is my code:
Dim theVal As Integer = cInt(major.text , Integer)
' major is the name of the textbox
SELECT * FROM glmaster WHERE glmaster.major = theVal
When I put a number ie. 1000 where theVal is in the select statement, the datagrid displays the correct data. But as soon as I put a variable there I get an error.
Try "SELECT * FROM glmaster WHERE glmaster.major =" + theVal.ToString