|
Give Error at GetType?
How track the Dynamic id of textbox?
|
|
|
|
|
developer.ravish wrote: Give Error at GetType?
What's the error? please be more descriptive when asking questions.
developer.ravish wrote: How track the Dynamic id of textbox?
What do you mean by this. If you mean how can you just put 'txt1.text' in your code and get the text form that dynamicly created textbox, then you can't (well maybe with reflection but I don't know).
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string query_ddl = "Query";
SqlDataAdapter da = new SqlDataAdapter(query_ddl, con);
DataSet ds = new DataSet();
con.Open();
da.Fill(ds);
con.Close();
ddl_value.DataSource = ds;
//ddl_value.DataTextField = "Range";
ddl_value.DataValueField = "Range";
ddl_value.DataBind();
ddl_value.Items.Insert(0, (new ListItem("Please Select Value", "0")));
}
}
protected void ddl_value_SelectedIndexChanged(object sender, EventArgs e)
{
createTextbox();
}
private void createTextbox()
{
TableRow tr = new TableRow();
TableCell tc = new TableCell();
string selectedValue = ddl_value.SelectedValue;
if (!string.IsNullOrEmpty(selectedValue))
{
int count = Convert.ToInt32(selectedValue.ToString());
for (int i = 0; i < count; i++)
{
tr = new TableRow();
tc = new TableCell();
TextBox txtbox = new TextBox();
txtbox.ID = "txt" + i.ToString();
tc.Controls.Add(txtbox);
tr.Cells.Add(tc);
tbl1.Rows.Add(tr);
tr = new TableRow();
tc = new TableCell();
TextBox txt_box = new TextBox();
txtbox.ID = "txt_" + i.ToString();
tc.Controls.Add(txt_box);
tr.Cells.Add(tc);
tbl2.Rows.Add(tr);
}
// tbl1.Rows.Add(tr);
}
}
Now on Button_Click i want to save Data From the Texboxes?
|
|
|
|
|
This is completely different than the first code you posted.
But basicly its the same, you'll have to go thru all the rows of tbl1 and tbl2.
Get the cell of that row(since you only have one column you should be able to get it very easy). That cell should then contain your textbox off which you can get the text.
pseudo code (vb.net sorry)
for each row as datarow in tbl1
dim txt as textbox = row.item(0).control(0)
dim data as string = txt.text
next
You'll have to adapt this code it is untested and from memory so...
|
|
|
|
|
|
Create an application that allows the user to enter the length for the three sides of a triangle as ints. The application should then determine whether the triangle is:
• A right triangle, two sides of the triangle form 90-degree angle
• An equilateral triangle, all sides of equal length
• Neither.
You must create a class to represent a triangle object and define the event handler for the Create Button. Define the necessary properties:
Constructor that take the length of the three sides of the triangle as arguments
Three properties that enable clients to access and modify the length of the three sides. If the user enters a negative value that side should be zero.
Tow features to determine whether the sides form a right triangle. The other an equilateral triangle only get accessor "read-only".
help to solve this program..please...please
|
|
|
|
|
I will!!
But first, build me a house that has:
- Four bedrooms
- A garage
- A beertender in every room
I are troll
|
|
|
|
|
Obvious homework questions don't go down well here. Be more specific, and show you've had a go first. You might get a useful an answer that way.
|
|
|
|
|
Sounds like an extract from an assignment brief lol
is it?
pretty basic stuff really. You know much c#?
|
|
|
|
|
Tell you what, as i feel in a helpful mode.
If you post at 12.30pm (My Time (in one hour))saying your still stuck, i will help you out with a bit of code. But give it a try yourself till then. its not too difficult for what you want to do
P.S are you doing a console app or a windows form or what?
|
|
|
|
|
Please don't do people's homework for them, not in its entireity anyway. They learn nothing, pass caourses, go out to work and the rest of us spend our life clearing up their mess!
|
|
|
|
|
As others have said, you have to do your own homework. If you don't, how do you expect to learn anything?
Provide the code you have written so far along with what you are stuck on and we will be only too glad to help you out.
|
|
|
|
|
Doesn't sound too difficult. What have you got so far and what bits of your code aren't working as expected?
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Right - here's how to solve your homework.
You have a good set of requirements there. Are there any areas you are unsure about from the requirements? If yes, seek clarification.
Once you are sure you fully understand the requirements, put a use case together to show how a user would interact with this. For such a trivial problem, the use case will be simple. You may also want to put together an activity diagram to help clarify points.
Now, your thoughts should really be coming together on this, so you are now ready to commit to a design. I'd recommend roughing out a class structure on paper.
Now, follow TDD practices to physically create your application. Remember to test for edge cases - these always end up catching people out.
|
|
|
|
|
You're going to fail your course, even if someone does this for you. So, practice with me 'do you want fries with that ?'
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Do you think people write these kind of posts just because they know lots of people will reply to complain about them?
|
|
|
|
|
Change majors.
"Well, we're getting "F"'d at work. WPF, WCF, and WWF... WTF?" --John Simmons
|
|
|
|
|
Hello,
I am creating a windows service which performs 20 operations based on some condition. So at one time one process will be executed.
All these 20 different tasks are separate assemblies added to the windows service. The objects and the call to the assembly will be made only when needed.
For example:
Case "findcustomer"
create object
process
Case "findVendor"
create object
process
Is this approach a good idea? Also I want to know what needs to be keep in mind related to design of this service.
Regards,
Pavas
Regards,
Pavas
|
|
|
|
|
hi. im thinking of building a multi user game that works over the internet but the clients are a desktop applications.
that means that the application will have to talk to a server on the internet and im not sure about what technology to use when sending messeges between the client and server.
is it "expensive" for example to use web service to communicate with the application?
what is the common use technology when developing such application?
|
|
|
|
|
Hi,
what do you mean by "expensive"? Regarding the speed of the application or the time to implement the app.
My opinion:
Implementing the app using the low-level TCP/IP (or UDP, depends on the app) protocol will result in fast communication between client and server, because web services are on a much higher level (ISO/OSI) using protocols like HTTP etc. Also you need an IIS to host the service etc. This will all slow down the app. But going this way will need you to invest time, because you have to implement all the stuff like opening sockets, handling server communication etc.
Hope this helps you a bit.
Regards
Sebastian
|
|
|
|
|
Hi
I would like to link ArrayList as datasource to datagridview
I’ve defined the
ArrayList arrList;
arrList = new ArrayList();
//Add data to list
arrList.Add(node_1);
...
arrList.Add(node_n);
dataGridView1.DataSource = arrList;
Adding the link is OK, the problem is that I see all the members of nodes in datagridview and I wish to see only specific members in the grid.
I try to manually add columns to grid and it didn’t help, I see all members of node in datagridview
Please advice
Thanks
Ronen
|
|
|
|
|
maybe you should forget the datasource option and update the grid view as required by looping through the array list. That way you can display what ever you want how you want, much more control that way
|
|
|
|
|
See this is my code same as you want , this works for me correctly:
<br />
grdRequests.Columns.Clear();<br />
<br />
<br />
loanRequests =
grdRequests.DataSource = loanRequests;<br />
grdRequests.DataKeyNames = new string[] { "ID" };<br />
<br />
<br />
<br />
CommandField SelectField = new CommandField();<br />
SelectField.SelectText = "field1";<br />
SelectField.ShowSelectButton = true;<br />
grdRequests.Columns.Add(SelectField);<br />
<br />
<br />
BoundField IDField = new BoundField();<br />
IDField.DataField = "ID";<br />
IDField.HeaderText = "field2";<br />
grdRequests.Columns.Add(IDField);<br />
<br />
...<br />
<br />
<br />
grdRequests.DataBind();<br />
Human knowledge belongs to the world
|
|
|
|
|
The DataGridView will automatically show ALL public properties of your Node class.
So you could do as musefan has suggested, or a possible alternative is to create a new class 'GriddableNode' which holds only the properties you wish to display, then create a list of some sort to use as the datasource for the DataGridView. OR you could edit the columns of the DataGridView, use the SmartTag for the gridview in the designer.
Henry Minute
If you open a can of worms, any viable solution *MUST* involve a larger can.
|
|
|
|
|
I am passing the data of an element inside an xml file into a sql server table with field varchar(max). This datatype is permanent and due to business rule is not allowed to be changed.
The xml file contains something like:
i.e.
<file>
<data>
-----1234------
This is the value for the first item...
</data>
<data>
-----9876------
This is the value for the second item...
</data>
</file>
Notice, there are spaces and carriage returns.
When pulling these data out of the xml file, in the immediate window, I can see "\r\n\r\n" attached to the text where there should be a return.
Problem:
The sql does not take care of these returns, so that when I show these values on the UI, I do not see the carriage returns.
Question:
How do I see the text on the UI as it exacly appears in the xml file ?
Thanks
|
|
|
|