Showing posts with label shown. Show all posts
Showing posts with label shown. Show all posts

Wednesday, March 28, 2012

the column size of gridview

hi all:

the one of the column of gridview got multiple line data to be shown , so
how do i deal with it? what i am thinking about is using template field
instead of the boundfield. is that other solution out there?

Cheers

NickHi Nick,

You can solve this problem with the DataGridView.AutoSizeColumns() method,
with one of the values from the DataGridViewAutoSizeColumnCriteria
enumeration.
You can choose to size columns based on the width of header text, the
currently displayed rows, or all the rows in the table.

The following code snippet resize columns based on the width of the largest
piece of text in a header or one of the rows for this column.
DataGridView1.AutoSizeColumns( _
DataGridViewAutoSizeColumnCriteria.HeaderAndRows)

Please note that this method needs to be invoked after you bind the data or
it won't have any effect. You might also want to use it after user editing
(perhaps in response to an event like DataGridView.CellValueChanged).

Rather than widening columns to fit, you can change the row size. By
default, the text in a column will wrap over multiple lines.

If you use the DataGridView.AutoSizeRows() method, the row will be
heightened to fit the content.

Before you use this method, you might want to widen the column size,
particularly if you have a field that contains a large amount of text. For
example, the following code snippet quadruples the size of the Description
column, and then resizes
the rows to accommodate the content.

DataGridView.Columns("Description").Width *= 4
DataGridView.AutoSizeRows( _
DataGridViewAutoSizeRowsMode.HeaderAndColumnsAllRo ws)

Pls let me know whether this helps you
Thanks & Regards,
Sundar Narasimman

"Nick" wrote:

Quote:

Originally Posted by

hi all:
>
the one of the column of gridview got multiple line data to be shown , so
how do i deal with it? what i am thinking about is using template field
instead of the boundfield. is that other solution out there?
>
Cheers
>
Nick

Saturday, March 24, 2012

The designer could not be shown for this file ... in VS 2003 - Please HELP!

Here is what I did to remedy the problem on my system:

1. Uninstalled Visual Studio.NET and any related programs that get
installed with Visual Studio.NEt (Framework 1.1, etc.)

2. Deleted the directory C:\Documents and Settings\Administrator\Local
Settings\Application Data\Microsoft\VisualStudio. Repeat this for the
"All Users" directory under "Documents and Settings".

3. Removed any applications that had anything to do with eVB, eVC,
CompactFramework, SmartPhone SDK, etc.

4. Removed any residual directories on the hard drive that had to do
with eVB, eVC, CompactFramework, SmartPhone SDK, etc.

5. Removed from the registry everything that had to do with eVB, eVC,
"Windows CE", "Platman", "Visual Studio.NET"

5. Ran Microsoft RegClean to clean up the registry.

6. Rebooted the machine and reinstalled Visual Studio.NET 2003.

Hope this helps,
Johann Blake

Mobile solutions using GPS
www.closerworlds.com/engI solved this problem but didn't have the time to post what I found.

All I had to do is delete the OBJ and BIN folders from all projects in
the solution, then choose rebuild all. It worked then without even
restarting Visual Studio.NET itself

I hope this helps

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
I was having the same problem and you post help fixes it.

Thank you so much!

"Mohammed Banat" <mbanat@.e-sensejo.com> wrote in message
news:ukRrI8SRDHA.2196@.TK2MSFTNGP11.phx.gbl...
> I solved this problem but didn't have the time to post what I found.
> All I had to do is delete the OBJ and BIN folders from all projects in
> the solution, then choose rebuild all. It worked then without even
> restarting Visual Studio.NET itself
> I hope this helps
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!

Happy to hear it worked.

I will be happier to learn that the next service release/service pack
will have this solved.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
I was encountering this issue as well. I tried a lot of the
suggestions, but it came down to a project version issue. This is hard
to explain as it was hard to discover.

I have 3 projects. Project 1 is my asp.net application. Project 2 has
my base page. Project 3 has a lot of core classes used by both project
1 and 2. Project 2 and 3 are in the same solution. I built project 3
and copied the dll from the build directory to a central place where I
store my dlls. Later I made changes to project 2 and only copied the
dll from project 2 to the central location. Since project 2 and 3 are
in the same solution project 2 has a project reference to project 3.
Both of them have an AssemblyVersion of "1.0.*". Since the dlls from
project 2 and 3 were from different builds project 2 had a version
conflict.

The designer was the only thing that did not work. The application
still ran fine. All I had to do was make sure that I use the dlls from
the output (bin folder) of project 2 from the same build version. I
performed a lot of the above mentioned steps from removing the bin and
obj folders to deleting temp files. Getting the same versions of the
dlls was the step that finally resolved my issue and let me use the
designer again.

Thursday, March 22, 2012

The first intem in a DropDownList is vanishing!

The first intem in a DropDownList is vanishing!

My code to load a DropDownList is shown below. Yet when I load the
page after a postback there is no zeroth item present.

lstManager.Items.Clear();

lstManager.DataSource = _dsData.Tables["manager"].DefaultView;
lstManager.DataValueField = "ManagerID";
lstManager.DataTextField = "Name";
lstManager.DataBind();

lstManager.Items.Insert(0, new ListItem("none", "0"));

There's nothing special about the control definition:

<asp:DropDownList ID="lstManager" runat="server" Height="20px"
Width="250px" />

What's going on here?

This was the old code I replaced. Why does the old code (below) work
and why is my new code (above) broke?

lstManager.Items.Clear();

ListItem li = new ListItem("none","0");
lstManager.Items.Add(li);

foreach (DataRow drManager in _dsData.Tables["manager"].Rows)
{
ListItem liManager = new ListItem((string)drManager["Name"],
((int)drManager["ManagerID"]).ToString());
lstManager.Items.Add(liManager);
}I had this one a while back; turns out I was using simple properties
on a Master Page that required a DataBind() call to bind them. When
it was called, it was also rebinding the content page, which loses the
manually added items.

I recall this issue also happened with an ASCX file on the page, or if
you call a generic DataBind() any time after the addition of
ListItems, etc.

Dunc
http://www.fluidfoundation.com
On 1 Jun, 15:24, mark4asp <mark4...@.gmail.comwrote:

Quote:

Originally Posted by

The first intem in a DropDownList is vanishing!
>
My code to load a DropDownList is shown below. Yet when I load the
page after a postback there is no zeroth item present.
>
lstManager.Items.Clear();
>
lstManager.DataSource = _dsData.Tables["manager"].DefaultView;
lstManager.DataValueField = "ManagerID";
lstManager.DataTextField = "Name";
lstManager.DataBind();
>
lstManager.Items.Insert(0, new ListItem("none", "0"));
>
There's nothing special about the control definition:
>
<asp:DropDownList ID="lstManager" runat="server" Height="20px"
Width="250px" />
>
What's going on here?
>
This was the old code I replaced. Why does the old code (below) work
and why is my new code (above) broke?
>
lstManager.Items.Clear();
>
ListItem li = new ListItem("none","0");
lstManager.Items.Add(li);
>
foreach (DataRow drManager in _dsData.Tables["manager"].Rows)
{
ListItem liManager = new ListItem((string)drManager["Name"],
((int)drManager["ManagerID"]).ToString());
lstManager.Items.Add(liManager);
}


On 1 Jun, 16:30, Dunc <duncan.we...@.gmail.comwrote:

Quote:

Originally Posted by

I had this one a while back; turns out I was using simple properties
on a Master Page that required a DataBind() call to bind them. When
it was called, it was also rebinding the content page, which loses the
manually added items.
>
I recall this issue also happened with an ASCX file on the page, or if
you call a generic DataBind() any time after the addition of
ListItems, etc.
>
Dunchttp://www.fluidfoundation.com
>
On 1 Jun, 15:24, mark4asp <mark4...@.gmail.comwrote:
>
>
>

Quote:

Originally Posted by

The first intem in a DropDownList is vanishing!


>

Quote:

Originally Posted by

My code to load a DropDownList is shown below. Yet when I load the
page after a postback there is no zeroth item present.


>

Quote:

Originally Posted by

lstManager.Items.Clear();


>

Quote:

Originally Posted by

lstManager.DataSource = _dsData.Tables["manager"].DefaultView;
lstManager.DataValueField = "ManagerID";
lstManager.DataTextField = "Name";
lstManager.DataBind();


>

Quote:

Originally Posted by

lstManager.Items.Insert(0, new ListItem("none", "0"));


>

Quote:

Originally Posted by

There's nothing special about the control definition:


>

Quote:

Originally Posted by

<asp:DropDownList ID="lstManager" runat="server" Height="20px"
Width="250px" />


>

Quote:

Originally Posted by

What's going on here?


>

Quote:

Originally Posted by

This was the old code I replaced. Why does the old code (below) work
and why is my new code (above) broke?


>

Quote:

Originally Posted by

lstManager.Items.Clear();


>

Quote:

Originally Posted by

ListItem li = new ListItem("none","0");
lstManager.Items.Add(li);


>

Quote:

Originally Posted by

foreach (DataRow drManager in _dsData.Tables["manager"].Rows)
{
ListItem liManager = new ListItem((string)drManager["Name"],
((int)drManager["ManagerID"]).ToString());
lstManager.Items.Add(liManager);
}- Hide quoted text -


>
- Show quoted text -


Thanks Dunc, for sharing that with me - that scenario you described
sounds very like mine.

The first intem in a DropDownList is vanishing!

The first intem in a DropDownList is vanishing!
My code to load a DropDownList is shown below. Yet when I load the
page after a postback there is no zeroth item present.
lstManager.Items.Clear();
lstManager.DataSource = _dsData.Tables["manager"].DefaultView;
lstManager.DataValueField = "ManagerID";
lstManager.DataTextField = "Name";
lstManager.DataBind();
lstManager.Items.Insert(0, new ListItem("none", "0"));
There's nothing special about the control definition:
<asp:DropDownList ID="lstManager" runat="server" Height="20px"
Width="250px" />
What's going on here?
This was the old code I replaced. Why does the old code (below) work
and why is my new code (above) broke?
lstManager.Items.Clear();
ListItem li = new ListItem("none","0");
lstManager.Items.Add(li);
foreach (DataRow drManager in _dsData.Tables["manager"].Rows)
{
ListItem liManager = new ListItem((string)drManager["Name"],
((int)drManager["ManagerID"]).ToString());
lstManager.Items.Add(liManager);
}I had this one a while back; turns out I was using simple properties
on a Master Page that required a DataBind() call to bind them. When
it was called, it was also rebinding the content page, which loses the
manually added items.
I recall this issue also happened with an ASCX file on the page, or if
you call a generic DataBind() any time after the addition of
ListItems, etc.
Dunc
http://www.fluidfoundation.com
On 1 Jun, 15:24, mark4asp <mark4...@.gmail.com> wrote:
> The first intem in a DropDownList is vanishing!
> My code to load a DropDownList is shown below. Yet when I load the
> page after a postback there is no zeroth item present.
> lstManager.Items.Clear();
> lstManager.DataSource = _dsData.Tables["manager"].DefaultView;
> lstManager.DataValueField = "ManagerID";
> lstManager.DataTextField = "Name";
> lstManager.DataBind();
> lstManager.Items.Insert(0, new ListItem("none", "0"));
> There's nothing special about the control definition:
> <asp:DropDownList ID="lstManager" runat="server" Height="20px"
> Width="250px" />
> What's going on here?
> This was the old code I replaced. Why does the old code (below) work
> and why is my new code (above) broke?
> lstManager.Items.Clear();
> ListItem li = new ListItem("none","0");
> lstManager.Items.Add(li);
> foreach (DataRow drManager in _dsData.Tables["manager"].Rows)
> {
> ListItem liManager = new ListItem((string)drManager["Name"],
> ((int)drManager["ManagerID"]).ToString());
> lstManager.Items.Add(liManager);
> }
On 1 Jun, 16:30, Dunc <duncan.we...@.gmail.com> wrote:
> I had this one a while back; turns out I was using simple properties
> on a Master Page that required a DataBind() call to bind them. When
> it was called, it was also rebinding the content page, which loses the
> manually added items.
> I recall this issue also happened with an ASCX file on the page, or if
> you call a generic DataBind() any time after the addition of
> ListItems, etc.
> Dunchttp://www.fluidfoundation.com
> On 1 Jun, 15:24, mark4asp <mark4...@.gmail.com> wrote:
>
>
>
>
>
>
>
>
>
>
>
>
>
> - Show quoted text -
Thanks Dunc, for sharing that with me - that scenario you described
sounds very like mine.

Tuesday, March 13, 2012

the language shown in Chinese?

Hallo guys! Nice to join this forum!!

I have a question regarding ASP.NET web control. I created "Calendar" and I wrote simple code on it. Surprisingly after I run and display in IE, all the characters were in Chinese. I doubled check the control panel and set the regional and language to be all in English but all in vain. What should I do?

My second question is only for my own curiosity: After I did some changes to the language, I restart the PC and surprisingly the code window seemed to be zoom in a bit, it is now displayed in slightly larger fonts and a bit irritating.
Do you know how I could retrieve back the original font size in code window?

Thanks =)Internet Explorer > Tools > Options > Language button.

What language do you have there?
Hi, hehehe... I checked already, it was shown English (United Kingdom)...

But still cannot display correct English Calendar! Thanks!