|
The problem is that I do not know the field name... I need to know the attribute of the field [being the primary key] .
-Steven Hicks CPACodeProjectAddict
|
|
|
|
|
hmm ok I'm not sure you can do this in itemdatabound as you need to set the datakeyfield property of the datagrid itself before binding... if you are binding to a table in a dataset, the PrimaryKey property of the table returns an array of columns that function as primary keys for said table...
Fred
|
|
|
|
|
I have a DataGridView and would like to set the back and fore colors of certain rows based on the data in the table the grid is bound to. How is this done? I've tried looping through the grid and setting the DefaultCellStyle for the rows I want changed, but it doesn't do anything. I would appreciate any help or advice.
|
|
|
|
|
Hi
You want to retrieve each row and assign backcolor.
Eg:
Dim gvr As GridViewRow = GridView1.Rows(i)
gvr.BackColor = Drawing.Color.Beige
like this
To succeed, we must first believe that we can.
Sherin Iranimose
|
|
|
|
|
I have continued to work on this problem and have gotten a little further, but I am still having trouble. First of all, to be clear, I'm working with a DataGridView control. A DataGridViewRow does not have a BackColor property to set. What I'm doing now is looping through each row in the DataGridView and then each cell in that row and setting the style of that cell based on my own criteria. The problem is, that when I call this code in the form load event, it doesn't appear to work. But if I call it from another event that fires after the page has loaded, it DOES work. Does anyone know why this is, or what I can do to work around it? My goal here is that I have a grid that holds records AND related subrecords. I want to do an alternating highlight, but I want to include the subrecords in the highlight, so the highlight is not going to necessarily be every other line. Here is the code I am using:
Dim boolNormal As Boolean = True
Dim sNormal As New DataGridViewCellStyle
sNormal.BackColor = Color.White
sNormal.ForeColor = Color.Black
sNormal.SelectionBackColor = Color.White
sNormal.SelectionForeColor = Color.Black
Dim sContrast As New DataGridViewCellStyle
sContrast.BackColor = gblclrContrastBack
sContrast.ForeColor = gblclrContrastFont
sContrast.SelectionBackColor = gblclrContrastBack
sContrast.SelectionForeColor = gblclrContrastFont
For Each dgvr As DataGridViewRow In dgvFields.Rows
If dgvr.Cells("PDSeq").Value.ToString.Trim.Length = 0 Then
'Main Record
If boolNormal Then
For Each dgvc As DataGridViewCell In dgvr.Cells
dgvc.Style = sNormal
Next
Else
For Each dgvc As DataGridViewCell In dgvr.Cells
dgvc.Style = sContrast
Next
End If
boolNormal = Not boolNormal
Else
'Sub Record
If boolNormal Then
For Each dgvc As DataGridViewCell In dgvr.Cells
dgvc.Style = sContrast
Next
Else
For Each dgvc As DataGridViewCell In dgvr.Cells
dgvc.Style = sNormal
Next
End If
End If
Next
|
|
|
|
|
I finally figured it out. Because my form has so many controls, I have them all on a panel that has it's visibility set to false. Then when the form is done with the page load event, it sets the visibility of the panel to true. This just makes things look nicer when the program is running and the form loads...(you don't see the flicker of the controls being loaded, or the values that are in them during design time). For some reason, the code I use needs to be run AFTER the line of code that sets the visiblity of the form to true. Otherwise it doesn't work. I'm not quite sure why, and I really don't have the time to try and figure it out right now. But thank you for your input and time on this problem. I really appreciate it.
|
|
|
|
|
I think it is a problem by set visible= false
So try this.
Create to CSS classes
.show{ display:block; }
.hide{ display:none; }
to hide
Panel1.CssClass="hide"
to show
Panel1.CssClass="show"
To succeed, we must first believe that we can.
Sherin Iranimose
|
|
|
|
|
hello
i really dont know the differences between these two.
are they the same?
I want to learn AJAX programming with ASP.NET but i dont know which to learn.
Atlas or AJAX.NET?
|
|
|
|
|
Atlas is what AJAX.NET was called before it was released. You won't learn AJAX that way, it's a framework that hides the details from you, but that makes it a quick and easy solution.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Ajax.NET and Atlas are two frameworks that utilize Ajax technologies. Some of the differences between the two are:
Ajax.NET created, built and tested by one individual. Atlas, created by Microsoft.
Ajax.NET is very low level, you need to create a lot of JavaScript files to benefit from it which gives you great flexibility. Atlas, has a number of prebuilt "controls" and objects with little to no JavaScript.
I have created a presentation on AjaxPro.NET and a users guide at my website.
|
|
|
|
|
Oh - I thought Ajax.NET is what they call ATLAS now ? Oh, it's ASP.NET AJAX. My bad, sorry.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: Oh - I thought Ajax.NET is what they call ATLAS now ? Oh, it's ASP.NET AJAX. My bad, sorry.
Glad I read your post before leaping in with "bollox - they're both the same"
"Knock me down, I'll get straight back up again, I'll come back stronger than a powered up pacman"
(Lilly Allen / Kaiser Chiefs)
|
|
|
|
|
You don't need any of them. Using those frameworks, just makes everything more confusing (you have to learn them and work around them) and is an excuse to not learn javascript. Just do all your ajax stuff in javascript using the prototype library. I'd be suprised how well AJAX font-end + ASP.net back-end work togeather.
/\ |_ E X E GG
|
|
|
|
|
Hi
Is there a spreadsheet control available in ASP.NET?
Thanks
|
|
|
|
|
There are commercial ones, or you can use the datagrid ( which is not quite the same thing )
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
What kind of technique does Google use? It must be custom of course, but I heard they used VML or SVG?
What would you think be the best method to implement a custom spreadsheet control ?
|
|
|
|
|
I dunno, I guess look at the source.
Revant Jain wrote: What would you think be the best method to implement a custom spreadsheet control ?
I dunno that I'd use SVG. It seems to me that a spreadsheet is a table, and the rest of it is just a bunch of javascript. I mean, how else could it work ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi All,
I am beginer in web designing. I designed a website and it looks fine in IE-6. But if I try to open the same in IE-7 or Mozilla firefox, it looks funny. The center column overalps with left hand side menu.
Meanwhile, I tried the below:
1) ie.browser and mozilla.browser files are included in the app_browsers directory.
2) Tried using "iehacks.css". In iehacks.css, I did the following:
a) "min-height:" is set to the divs that are having problem.
b) .clearfix:after {content: "."; display: block; height: 0; clear: both;
visibility: hidden;}
.clearfix {display: inline-table; min-height:1%;}
/* Hides from IE-mac \*/
* html .clearfix {height: 1%;}
.clearfix {display: block;}
/* End hide from IE-mac */
but these did not help me.
Could anyone please help me to resolve this issue.
Thanks in advance.
|
|
|
|
|
anyone plz help me....its very urgent!
|
|
|
|
|
Hello!
I'm quite new to the ASP.NET world and I'm trying to build a menu with sub menu items, I know that their is a pre-build Menu control but I still want to create my own. I'm only facing the last problem. The clientID's?
I've this recursive function:
<code>
private Panel GetMenu(int ParentID)
{
stefw.Database.Page objPage = new stefw.Database.Page();
Panel pnlBox = new Panel();
DataTable dtItems = objPage.GetChildPages(ParentID);
foreach (DataRow drItem in dtItems.Rows)
{
string url = "Default.aspx?Page=" + drItem["PageID"].ToString();
string name = drItem["Name"].ToString();
string link = "<a href=\"" + url + "\">" + name + "</a>";
Panel pnlItem = new Panel();
pnlItem.ID = "Item" + drItem["PageID"].ToString();
pnlItem.Controls.Add(new LiteralControl(link));
pnlItem.CssClass = "Item";
if (drItem["HasChildren"].ToString() == "1")
{
Panel child = GetMenu(int.Parse(drItem["PageID"].ToString()));
pnlBox.Attributes.Add("onMouseOver", "document.getElementByID('" + child.ClientID + "').style.overflow='visible'");
pnlItem.Controls.Add(child);
}
pnlBox.Controls.Add(pnlItem);
}
if (ParentID == -1)
pnlBox.CssClass = "MainItem";
else
pnlBox.CssClass = "Box";
pnlBox.ID = "Box" + ParentID.ToString();
return pnlBox;
}
</code>
and it gives this output:
<code>
<div id="ctl00_ctl00_Box-1" class="MainItem" onMouseOver="document.getElementByID('Box1').style.overflow='visible'">
<div id="ctl00_ctl00_Item1" class="Item">
<a href="Default.aspx?Page=1">Home</a><div id="ctl00_ctl00_Box1" class="Box">
<div id="ctl00_ctl00_Item3" class="Item">
<a href="Default.aspx?Page=3">Informatie</a>
</div>
</div>
</div><div id="ctl00_ctl00_Item2" class="Item">
<a href="Default.aspx?Page=2">Beheer</a>
</div>
</div>
</div>
</div>
</code>
You can see that it goes wrong at this line:
[document.getElementByID('Box1').style.overflow='visible'"]
and here
[pnlBox.Attributes.Add("onMouseOver", "document.getElementByID('" + child.ClientID + "').style.overflow='visible'");]
What am I doing wrong? Can anyone give me some advice? Thanks in advance!!!!!
Stef
|
|
|
|
|
ClientID is the id that the client sees. If you look at the source of your page from the browser (after it has been processed) your id's get changed to things like ctl00_YourID. There is a property for the controls called ClientID that you can assign the id so that you can access it with javascript on the client (this only matters for controls with runat="server").
|
|
|
|
|
Hi
I want to send an email out to a selection of people who will have registered for a course. Within their record they will have a course ID for the course they are on. I want to be able to click a button and it sends an email to all those with that courseID in their record. I can retrieve the course ID from the pages querystring.
Can someone please advise?
Many thanks
Adam
|
|
|
|
|
AdamskiR wrote: I can retrieve the course ID from the pages querystring
Only if the course ID is in the query string.
You should have some field or control where you select the course number you want to send emails for. Get the course ID from there when handling the button click event.
only two letters away from being an asset
|
|
|
|
|
The course ID is in the query string of the page.
Ive managed to get it now working.
Thanks
Adam
|
|
|
|
|
Hi,
In my ASP.Net application, ihave a calendar control created in javascript.On click of a image, the calendar pops up.I have two frames in my application.When i click on the button on frame1, i want the calendar to overlap the frame2.how to achieve this.currently since frame1 is 15% and frame2 is 85%, i can only see half of the calendar on frame1 and it does not allow me to drag it on frame2.
Plz helpme.
Thanks,
Riz
|
|
|
|