Click here to Skip to main content
15,889,216 members
Home / Discussions / C#
   

C#

 
AnswerRe: Optional Parameter Pin
Rei Miyasaka19-May-06 1:14
Rei Miyasaka19-May-06 1:14 
AnswerRe: Optional Parameter Pin
KrIstOfK19-May-06 2:06
KrIstOfK19-May-06 2:06 
Questionhow to extract motion vector from MPEG4 video? Pin
Raùl19-May-06 0:54
Raùl19-May-06 0:54 
AnswerRe: how to extract motion vector from MPEG4 video? Pin
leppie19-May-06 1:14
leppie19-May-06 1:14 
QuestionDisplaying controls still not working Pin
Brendan Vogt19-May-06 0:48
Brendan Vogt19-May-06 0:48 
AnswerRe: Displaying controls still not working Pin
_AK_19-May-06 1:29
_AK_19-May-06 1:29 
AnswerRe: Displaying controls still not working Pin
BoneSoft19-May-06 4:54
BoneSoft19-May-06 4:54 
QuestionRe: Displaying controls still not working [modified] Pin
Brendan Vogt22-May-06 21:07
Brendan Vogt22-May-06 21:07 
Hi,

Something really weird is happeneing here, and I can't explain why.

Let me give you a brief explanation what happens. When the pages loads for the first time it loads all the hub groups into a dropdown control, that's all. Each hub group can have 0, 1, or many hubs. I don't know how many hubs there are per hub group. When the user selects a hub group, it sets a panel to true, and loads all the related hubs, with textboxes. The textboxes are generated automatically. I give the ID of each textbox "txt" plus the ID of the hub (from the database).

This is my code in the .aspx file (just some of it):

<asp:Content id="cntBodyContent" ContentPlaceHolderID="cphBodyContent" Runat="Server">

<h5>Hub Group</h5>
<asp:DropDownList id="cboHubGroup" AutoPostBack="true" OnSelectedIndexChanged="cboHubGroup_SelectedIndexChanged" runat="server" />

<asp:Panel id="pnlHubCommissions" Visible="false" runat="server">

<asp:Table id="tblHubCommRates" BorderWidth="1" Width="100%" runat="server"></asp:Table>
<asp:Button id="btnInsert" Text="Insert" CssClass="FormButton" runat="server" OnClick="btnInsert_Click" />

</asp:Panel>

</asp:Content>

When I generate the textboxes for each hub, this is my code:

string strHubs = string.Empty;
TextBox tb;

List<Hub> lstHubs = Hub.GetHubsByHubGroupID(Int32.Parse(cboHubGroup.SelectedValue));

foreach (Hub h in lstHubs)
{
TableRow tRow = new TableRow();

tblHubCommRates.Rows.Add(tRow);

TableCell tCell1 = new TableCell();
TableCell tCell2 = new TableCell();

tCell1.Text = "<h5>" + h.HubName + "</h5>";
tCell1.Width = Unit.Percentage(15);
tRow.Cells.Add(tCell1);

tb = new TextBox();
tb.ID = "txtHubCommRate" + h.HubID;
tb.Width = Unit.Pixel(44);
tb.MaxLength = 6;
tb.CssClass = "InputText";
tCell2.Controls.Add(tb);
tCell2.Width = Unit.Percentage(85);
tRow.Cells.Add(tCell2);
}

My button event handler:

protected void btnInsert_Click(object sender, EventArgs e)
{
// It does nothing yet
}

Everything displays well, 100% in fact. But this is where I am having my problem. When I click on the buttion, then table with the results generated disappears. Not sure why this happens. This is why I think it can not display the controls, because it is not there. Is there a reason for this??

I hope someone can help. If I have left out something, please let me know. If I can get this to work, then I can think about trying to display the textbox values.

Regards,
ma se
QuestionHow to Increase the header height of datagrid in c# windows application Pin
Qutub19-May-06 0:14
Qutub19-May-06 0:14 
AnswerRe: How to Increase the header height of datagrid in c# windows application Pin
Mukesh Karir19-May-06 1:28
Mukesh Karir19-May-06 1:28 
QuestionInstant Messenger in C# Pin
rev 'ed18-May-06 23:59
rev 'ed18-May-06 23:59 
AnswerRe: Instant Messenger in C# Pin
Robert Rohde19-May-06 0:09
Robert Rohde19-May-06 0:09 
AnswerRe: Instant Messenger in C# Pin
Yulianto.19-May-06 0:34
Yulianto.19-May-06 0:34 
Questiondropdownlist in gridview to calculate result Pin
Ritaa18-May-06 23:32
Ritaa18-May-06 23:32 
QuestionApplication.AddChartAutoFormat in excel template Pin
kiran.v.nair18-May-06 23:23
kiran.v.nair18-May-06 23:23 
QuestionMultiple cells selction in datagrid contol Pin
buzzy8418-May-06 23:02
buzzy8418-May-06 23:02 
AnswerRe: Multiple cells selction in datagrid contol Pin
Robert Rohde18-May-06 23:44
Robert Rohde18-May-06 23:44 
AnswerRe: Multiple cells selction in datagrid contol Pin
_AK_18-May-06 23:52
_AK_18-May-06 23:52 
QuestionHow does it work open Background image in Visual Studio? Pin
Sasuko18-May-06 22:39
Sasuko18-May-06 22:39 
AnswerRe: How does it work open Background image in Visual Studio? Pin
Robert Rohde18-May-06 23:38
Robert Rohde18-May-06 23:38 
GeneralRe: How does it work open Background image in Visual Studio? Pin
Sasuko18-May-06 23:41
Sasuko18-May-06 23:41 
GeneralRe: How does it work open Background image in Visual Studio? Pin
Robert Rohde19-May-06 4:40
Robert Rohde19-May-06 4:40 
GeneralRe: How does it work open Background image in Visual Studio? Pin
Susuko19-May-06 12:01
Susuko19-May-06 12:01 
QuestionFTP List Response Formating question... Pin
Leon van Wyk18-May-06 22:22
professionalLeon van Wyk18-May-06 22:22 
QuestionProblem in restoring the minimized IE windows Pin
Kuldeep_T18-May-06 22:01
Kuldeep_T18-May-06 22:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.