|
Somewhere there is something wrong with my code.
When I go a create my textbox dynamically I did it like this:
foreach (Hub h in lstHubs)
{
strHubs = strHubs + "<tr>" +
"<td width=\"15%\"><h5>" + h.HubName + "</h5></td>" +
"<td width=\"85%\">" + "<input type=\"text\" id=\"txtHub" + h.HubID + "\" size=\"7\" MaxLength=\"6\" class=\"InputText\" runat=\"server\" />%<br />" + "</td>" +
"</tr>";
}
When I do that loop of yours it does not bring back anything. So did I declare my textbox incorrectly?
Please help.
|
|
|
|
|
foreach(Control control in Controls)
{
TextBox textBox = control as TextBox;
if(textBox != null)
{
MessageBox.Show(textBox.Name + ":" + textBox.Text);
}
}
|
|
|
|
|
Thanks!!
What I am trying to is to display each hub, with a textbox next to it. There can be many many or few hubs for each hub group. I do it like this:
List<Hub> lstHubs = Hub.GetHubsByHubGroupID(Int32.Parse(cboHubGroup.SelectedValue));
foreach (Hub h in lstHubs)
{
strHubs = strHubs + "<tr>" +
"<td width=\"15%\"><h5>" + h.HubName + "</h5></td>" +
"<td width=\"85%\">" + "<input type=\"text\" id=\"txtHub" + h.HubID + "\" size=\"7\" MaxLength=\"6\" class=\"InputText\" runat=\"server\" />%<br />" + "</td>" +
"</tr>";
}
The way that I'm doing it seems like it's not adding it as a asp:Textbox control. I do not' know how to add it other wise to the table.
Please can toy help.
`
|
|
|
|
|
Thanks, this worked just fine.
Sorry for only getting back now.
|
|
|
|
|
Is there a class that provides Licensing mechanism for C# apps? Like a user must provide a product KEY (Registration Key) during installation?
If not then is there a tutorial or an article that I can look at? Thanks.
|
|
|
|
|
hi all,
in my form i display a print dialog after a messageboxbuttons.okcancel.
how will i decide if the user press 'ok' or 'cancel' on messagebox ???
is there a code to distinguish them ?
|
|
|
|
|
As you can see from the documentation, the MessageBox.Show()[^] method returns a DialogResult[^] which will tell you what button was pressed.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Yes...
You can get the return value from Show() method.
for example :
DialogResult dialogResult = MessageBox.Show("My Text", "My Title", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
if(dialogResult == DialogResult.OK)
{
}
else if(dialogResult == DialogResult.Cancel)
{
}
|
|
|
|
|
Hi,
this is simple. read this example from msdn
Private Sub ValidateUserEntry2()<br />
<br />
<br />
' Checks the value of the text.<br />
<br />
If ServerName.Text.Length = 0 Then<br />
<br />
' Initializes variables to pass to the MessageBox.Show method.<br />
<br />
Dim Message As String = "You did not enter a server name. Cancel this operation?"<br />
Dim Caption As String = "No Server Name Specified"<br />
Dim Buttons As Integer = MessageBoxButtons.YesNo<br />
<br />
Dim Result As DialogResult<br />
<br />
'Displays a MessageBox using the Question icon and specifying the No button as the default.<br />
<br />
Result = MessageBox.Show(Me, Message, Caption, MessageBoxButtons.YesNo, _<br />
MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign)<br />
<br />
<br />
' Gets the result of the MessageBox display.<br />
<br />
If Result = DialogResult.Yes Then<br />
<br />
' Closes the parent form.<br />
<br />
Me.Close()<br />
<br />
End If<br />
<br />
End If<br />
<br />
End Sub
Anant Y. Kulkarni
|
|
|
|
|
I need the control to mimic the functionality provided by OUTLOOK. i.e: the email can be grouped by DATE, FROM, TO etc. and each group can be collapsed and expanded to reveal more information.
So for example in our application...I want to see a list of clients grouped by CASE. every CASE group can be expanded to reveal the clients associated with that case
e.g:
===============================================
SURNAME ^ | NAME ^ | DATE ADDED
===============================================
- CASE A
Putter David 01 June 2006
Smith Kelly 24 May 2006
+ CASE B
+ CASE C
|
|
|
|
|
|
well listview 2.0 supports grouping but not expaned and collapse mode like you want. However, you use an off the shelf component called SandGrid it is produced by a company in the UK called DivElements. In my opinion this is a damn good component to use plus its very cheap. try http://www.divelements.co.uk/net/controls/sandgrid/
|
|
|
|
|
Thanks. How does one programmatically highlight or de-highlight a listview items which is sitting inside a listview control? i.e. what events get called
|
|
|
|
|
Is this possible to achieve without having tons of code for checking ms excel versions etc?
|
|
|
|
|
Just use the System.Threading.Proccess.Start () method.
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
With that method I have to give directions to the .exe file if Im not mistaken. This is a problem since this is going to alot of clients...
|
|
|
|
|
No you just pass it the filename of your xls file and then the client's OS will open the file in the program that is registered to handle this files.
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
sweet, it worked thanks alot.
|
|
|
|
|
Hi,
I don't know how to get IIS root path at win form project(c#).
example.
http://localhost/web-app
-->> I wanna get 'c:\Inetpub\web-app' in c# program.
pleases, write message
or
send email
thanks.
-- modified at 8:57 Wednesday 17th May, 2006
|
|
|
|
|
See MSDN for Page.MapPath()[^]
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Not sure if this will work on a win forms project
|
|
|
|
|
I didn't notice.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Hi,
I'm using ASP.NET and C#.NET 2. I have to dynamically display all hubs for a given hub group. A user selects the hub group from a drop down, and all the related hubs load, with a textbox next to it. The id of the textbox will depend on the id of the hub, so if the hub ID is 2, then it's corresponding textbox name will be txtHub2.
This my table where I have a label control. The label control will contain all the <tr></tr> and <td></td>.
<table border="1" cellpadding="0" cellspacing="0" width="100%">
<asp:Label id="lblHubCommissions" runat="server" />
</table>
In cboHubGroup_SelectedIndexChanged(object sender, EventArgs e) event handler I have the following:
string strHubs = string.Empty;
List<Hub> lstHubs = Hub.GetHubsByHubGroupID(Int32.Parse(cboHubGroup.SelectedValue));
foreach (Hub h in lstHubs)
{
strHubs = strHubs + "<tr>" +
"<td width=\"30%\">" + h.HubName + "</td>" +
"<td width=\"70%\">" + "<asp:TextBox id=\"txtHub" + h.HubID + "\" Columns=\"35\" MaxLength=\"50\" CssClass=\"InputText\" runat=\"server\" /><br />" + "</td>" +
"</tr>";
}
if (strHubs != string.Empty)
lblHubCommissions.Text = strHubs.Substring(0, strHubs.Length - 2);
else
lblHubCommissions.Text = "No available hubs.";
The textboxes don't wan't to display. But if I view the source then it is there. Why is this?
Regards,
ma se
(South Africa)
|
|
|
|
|
hi all,
i have 2 buttons on a simple form.
both do different things.
but i want button2 to be treated as if its clicked if i click on button1.
how can i do this ?
|
|
|
|
|
what i got is you want to click the button 2 when u click button 1 if its the case
then just call button two click event on the button1 click event
private void button1_click(Object Sender, Args e )
{
Button2_click(sender, e);
}
in heading you are saying enabling for enable u can use the property
button1.enabled=true or false.
hope this will help you.
Naveed Kamboh
|
|
|
|