|
This stuff is a bit horrid in C#. What you are doing here is declaring a jagged array of type int . That is to say an array of arrays of int .
Now I'm not quite sure why you are getting that particular error - something to do with it assuming you are using an indexer rather than dereferencing an array I guess, but the code is flawed. Having new ed up the outer array, you will need to create an inner array for each and every item in the outer array. Confusing stuff, especially if you're from a C++ background. I'd expect you to get null reference exceptions instead. Arrays are references types (of type System.Array ) in .NET and must be new ed up before use.
Regards,
Rob Philpott.
|
|
|
|
|
Hi
I want to know how it s possible to hide a column in a gridview that s filled by a dataset. I know the property Gridview.Columns[index].Visible but when i put it to "false" i got an exception: ArgumentOutOfRange.
Can someone help me?
THx
|
|
|
|
|
Looks like the index value is out the range of the valid values, you might want to double check this value. Another option is to make all the cells of the specified column invisible. You can do that in the RowDataBound/RowCreated events of the GridView control.
|
|
|
|
|
Hi,
Actually I want the Data to be displayed in my DataGrid Control in Vertical Form. But i m unalble to. and also i want the Headings of the Columns to be displayed according to my Requirements(user defined) but it is always bounding data with the names of fields i.e. suppose if the field name is: Emp_ID, DataGride is showing the field name but i want Employee ID to be shown.
Is there any way to do this!!!
Plz Help
"You never know what is enough unless you know what is more than enough"
Thanks
|
|
|
|
|
regarding column header yes..
Atleast 2 ways to do this :
a. You can use an alias name while fetching from the database, like select abc as 'abc efg' from tablename.
2. You can make use of Column mapping
|
|
|
|
|
hai
i am ajay
i am making a datagrid at runtime and adding a template column to it.in the template column i am using a textbox and the second column is a label.
everything is working fine for me.but in the datagrid the two columns(textbox and label) are coming in a single column.although i have set all the necessary properties of datagrid at run time.
plz resolve my problem.
i am giving my code snippet.
coding is------
Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Data
Imports System.Data.SqlClient
Public Class WebForm1
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
'Template()
End Sub
Private Sub Template()
Dim DataGrid1 As New DataGrid
DataGrid1.AutoGenerateColumns = False
DataGrid1.GridLines = GridLines.Both
DataGrid1.BackColor = Color.Pink
DataGrid1.BorderWidth = Unit.Pixel(2)
DataGrid1.BorderColor = Color.Blue
DataGrid1.HeaderStyle.BackColor = Color.Yellow
DataGrid1.HeaderStyle.ForeColor = Color.Brown
DataGrid1.HeaderStyle.Font.Bold = True
DataGrid1.CellPadding = 10
Dim temp1 As String
Dim temp2 As String
temp1 = TextBox1.Text
temp2 = TextBox2.Text
Dim tempcol As New TemplateColumn
'tempcol.HeaderText = temp1
'Header Template
tempcol.HeaderTemplate = New MyTemp(ListItemType.Header, temp1, temp2)
'Item Template
tempcol.ItemTemplate = New MyTemp(ListItemType.Item, temp1, temp2)
'Add Template into Grid
DataGrid1.Columns.Add(tempcol)
'Binding Data Source
Dim cnn As New SqlConnection("")
Dim da As New SqlDataAdapter("")
Dim ds As New DataSet
da.Fill()
DataGrid1.DataSource = ds
DataGrid1.DataMember = ""
DataGrid1.DataBind()
'Bind Grid into panel
Me.Panel1.Controls.Add(DataGrid1)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Template()
End Sub
End Class
Public Class MyTemp
Implements ITemplate
Dim TemplateType As ListItemType
Dim Field1 As String
Dim Field2 As String
Dim heading1 As String
Dim heading2 As String
Sub New(ByVal type As ListItemType, ByVal fld1 As String, ByVal fld2 As String)
TemplateType = type
Field1 = fld1
Field2 = fld2
End Sub
Sub InstantiateIn(ByVal Container As Control) Implements ITemplate.InstantiateIn
Dim lbl1 As New TextBox
lbl1.BackColor = Color.Beige
Dim lbl2 As Label = New Label
Dim lc1 As LiteralControl = New LiteralControl
Dim lc2 As LiteralControl = New LiteralControl
Select Case TemplateType
Case ListItemType.Header
lc1.ID = "textbox1"
lc1.Text = Field1
Container.Controls.Add(lc1)
lc2.ID = "lc2"
lc2.Text = Field2
Container.Controls.Add(lc2)
Case ListItemType.Item
lbl1.ID = "lbl1"
AddHandler lbl1.DataBinding, AddressOf BindIntegerColumn
Container.Controls.Add(lbl1)
lbl2.ID = "lbl2"
AddHandler lbl2.DataBinding, AddressOf BindStringColumn
Container.Controls.Add(lbl2)
End Select
End Sub
Sub BindIntegerColumn(ByVal Sender As Object, ByVal e As EventArgs)
Dim lbl1 As New TextBox
lbl1 = CType(Sender, TextBox)
Dim Container As DataGridItem = CType(lbl1.NamingContainer, DataGridItem)
lbl1.Text = DataBinder.Eval(Container.DataItem, Field1)
End Sub
Sub BindStringColumn(ByVal sender As Object, ByVal e As EventArgs)
Dim lbl2 As Label = CType(sender, Label)
Dim Container As DataGridItem = CType(lbl2.NamingContainer, DataGridItem)
lbl2.Text = DataBinder.Eval(Container.DataItem, Field2)
End Sub
End Class
|
|
|
|
|
MissionSuccess wrote: 'Add Template into Grid
DataGrid1.Columns.Add(tempcol)
Your sample code tells me that you only add 1 column to the Columns collection of the datagrid. Don't be confused between two columns with two controls in a single column.
|
|
|
|
|
I currently hosted a site, and at the time of member registration we get the following error.
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customerrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customerrors> tag should then have its "mode" attribute set to "Off".
|
|
|
|
|
Follow the instructions , so that you can view the detail of the error...to identify the cause...
<< >>
|
|
|
|
|
Hi,
Thank you very much for your suggession.
I followed the instructions given in the error message.
But that raised one another error.
The error is "Could not Access CDO.Message Object".
On each exception I am seding mail to the admin.
This error comes every time when I am trying to send email through code.
I have wrriten code as following.
catch(Exception ex)
{
string MessageBody = "Exception " + ex.GetType.ToString() + " occured on page " + this.ID + " on " + DateTime.Now.ToString();
MailMessage mail = new MailMessage();
SmtpMail.SmtpServer.Insert(0,"66.36.242.151");
mail.From = "chetan@innovault.com";
mail.To = "admin@innovault.com";
mail.Subject = "Error Occured in the system.";
mail.Body = MessageBody;
SmtpMail.Send(mail);
}
Error comes When the Last Line of code executes.
Can u tell me if anything is wrong in my code?
Thank you.
Regards,
Chetan Ranpariya.
|
|
|
|
|
Hi Chetan,
Looking at the error "Could not Access CDO.Message Object", I think there is a problem related to the permissions to relay through the IIS SMTP Service.
To allow access, open up the IIS Admin MMC. Locate the SMTP Virtual Server, and right-click, then select Properties. On the Access tab, click the Relay button. In the Relay Restrictions dialog, grant your IP address
(e.g 127.0.0.1) to the Computers listbox. Close down all dialogs, and restart the SMTP Service.
I got the same problem some time back and used the above procedure. Hope it helps u..
For more details u can check this link
http://www.systemwebmail.com/faq/4.2.3.aspx[^][^]
Thanks for reading,
Vaibhav
|
|
|
|
|
Hi Vaibhav.
Thanks for the reply.
You are right vaibhav.
I have tried that. That works on my system very well.
But when I uploaded my site on the server and tried to test it, it gives me error.
For example you open www.innovault.com and try to make your login there.
Your login will be created successfully but you will get error page with error "Could not Access CDO.Message Object" as well.
This error comes when system tries to send u a mail informing that your account has been created including your username and password.
Is there any thing to setup from my mailserver or something else?
Plz reply me soont its very urgent.
Thank you very much.
Regards,
Chetan
|
|
|
|
|
Hi there,
For this issue, you might contact to the administrator of your website to fix the problem...
<< >>
|
|
|
|
|
Have you copied the web.config file? If not please copy that and try again. This error may also occur when a required file is missing.
|
|
|
|
|
I want to add(insert) lable or textbox in the Footer of the Data gridheader
Please explain me how to do that
|
|
|
|
|
|
Hi,
I have a form with the following format:
a the the top there are two buttons, followed by a text field, followed by a submit button. When I load the page, and press enter, nothing happens. When i select the text box and type stuff and press enter, the first button gets selected. The problem is this is a logout button. By default I want the submit button to be selected. I tried tabindex=1 on it but that didnt work. Any ideas? Thanks in advance,
|
|
|
|
|
Hi there,
use js code to set focus to the control at page load....
just simply put this js code: getElementbyId("your_button_id").focus() into onload event in body tag of the form
<< >>
|
|
|
|
|
|
hi
I am able to resolve my earlier issue but now a new problem has come up in this a web page "tvOnDemand.aspx" has some nodes if i click colors node i get a msg box Error loading callback data.I i run the XmlGenerator.aspx page i get the following error: (Its in ComponentArt)
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
Only one top level element is allowed in an XML document. Error processing resource 'http://localhost/reere/XmlGenerator.as...
<HTML>
-^
Earlier i got error in the following lines "" so i just removed it now i am getting the above error "Only one top elemt..."
Here can anyone help me to solve this problem
thanks in advance
|
|
|
|
|
Hi,
I would like to use .net passport with an asp.net application. I have installed the passport SDK.
I came across a website that said that after installing the SDK, the developer has to create an application in the .NET Services Manager.
In other words, the developer must submit the application information to Microsoft using the Microsoft .NET Services Manager. This allows the ASP.NET application to access the Microsoft Passport servers. Particulars about the application has to be entered.
Is it possible to have .net passport functionality done locally, instead of using Microsoft's Passport servers?
All I need is just a .net passport user account which can access 2 different websites.
The page explaining passport can be found here:
http://www.builderau.com.au/program/windows/soa/Integrate_Passport_into_ASP_NET_apps/0,39024644,20273635-1,00.htm
|
|
|
|
|
I have store documentfile in table,know i want retrive the documentfile and diplay into TextArea, it is diplay only text..if in documentfile any images and tables not display in Textarea
plz give suggestion,
bye
S.Reddy
|
|
|
|
|
|
If you, or anyone, knows one of these editors (esp a free one!)that works on Mac browsers I'd be glad to hear of it, because I certainly haven't...
cheers
P
|
|
|
|
|
Currently, I have no...
You might ask uncle Google...
<< >>
|
|
|
|