i am using 4 text boxes and a grid view in one of my application.I need to add the textbox values to the gridview,clear the textbox values and then enter the values into textboxes and click on button they should again go to gridview and the previously saved in the gridview should also be their in the gridview
Every Time i Enter values the 3rd and the 4th textbox values should add to the previous entered values and should be displayed on the gridivew
Please Helpme out
dev soni29 reputationPosted Dec 4, 2012, 2:31 AM EST
paste this code in WebForm1.aspx page
now paste this code in code behind page
now run the code and with this you will be able to add the dynamic values to the grid.i hope this works for you.
Regards
Devendra
Santosh Pisipati100 reputationPosted Dec 9, 2012, 11:39 PM EST
i have got some masked textboxes and they start with $0.00 say they should be inserted into gridview with same decimals.
Again They should retrieve back with the same decimals into another textbox on button click.
Early Reply is Needed Please
Thank You,
dev soni29 reputationPosted Dec 9, 2012, 11:54 PM EST
Add any data into the textbox and click on the add button and the data would be inserted into the Grid. :)
and if you can provide me the code then it will be easy to reply with the working code.:)
Santosh Pisipati100 reputationPosted Dec 10, 2012, 12:13 AM EST
Say if the textbox is masked in $0.00 fromat it should be saved in the save pattern in the gridview..but it is not ..
dev soni29 reputationPosted Dec 10, 2012, 12:28 AM EST
just replace the Button_click code with below given code it will work for you
i hope this code will work for you
Thanks
Dev :)
Santosh Pisipati100 reputationPosted Dec 10, 2012, 12:40 AM EST
Dev If You Wont Mind R u Familiar With Telerik Radcontrols ??
If Yes ther is another Doubt Regarding rad Ribbon Bar and Rad Tab Strip..
dr["Billed Us For"] = radbilledusfor.Text.Trim()==""?$0.00: radbilledusfor.Text;
dev soni29 reputationPosted Dec 10, 2012, 12:52 AM EST
$0.00 to "$0.00" it will work for you
thanks
Dev
:)
Santosh Pisipati100 reputationPosted Dec 10, 2012, 12:55 AM EST
dev soni29 reputationPosted Dec 10, 2012, 1:15 AM EST
protected void Button1_Click(object sender, EventArgs e)
{
DataRow dr = dt.NewRow();
dr["text1"] = TextBox1.Text.Trim()==""?"$0.00": TextBox1.Text;
dr["text2"] = TextBox2.Text;
dr["text3"] = TextBox3.Text;
dr["text4"] = TextBox4.Text;
dt.Rows.Add(dr);
GridView1.DataSource = dt;
GridView1.DataBind();
}
if not than try above given code otherwise send me the button click code ,if you can :)
then i can look into the prob.
Thanks
Dev
Santosh Pisipati100 reputationPosted Dec 10, 2012, 1:18 AM EST
Yes i have tried but isn't coming..
dev soni29 reputationPosted Dec 10, 2012, 1:26 AM EST
check the value of textboxes with debugging. Code is absolutely fine and working for me.so check with debugging.try this also
TextBox1.Text==string.Empty|| TextBox1.Text.Trim()==""?"$0.00": TextBox1.Text;
Thanks
Dev
Santosh Pisipati100 reputationPosted Dec 10, 2012, 1:32 AM EST
Also I have attached the Screen shot
dev soni29 reputationPosted Dec 10, 2012, 1:42 AM EST
have you checked the value of textbox with debugging,if not then do debugging and lemme know the value or you can print the value of textbox with this
put this line in as first line of button click
if it is Webapplication then
Response.Write(radbilledusfor.Text.Trim());
if it is winodow then
MessageBox.Show(radbilledusfor.Text.Trim());
and lemme know that value
Santosh Pisipati100 reputationPosted Dec 10, 2012, 1:51 AM EST
if i enter the Value as $1.11 it shows 111 in the Gridview i Have attached it in the Debugging Mode.
dev soni29 reputationPosted Dec 10, 2012, 1:57 AM EST
code is fine but the masking of the textbox is not right so change the ways of masking.
is it a window application or web application ?
i am damn sure about this
change the masking or find out the problem with the masking.
Thanks
Dev
Santosh Pisipati100 reputationPosted Dec 10, 2012, 1:58 AM EST
Also Dev are you familiiar with Telerik Radcontrols??
Santosh
Santosh Pisipati100 reputationPosted Dec 10, 2012, 2:08 AM EST
i Hav got a textbox and itshoud be validated with a query.On tabchange to another textbox field itshoud be validated with a query and return it and not able to write in the next textbox untill the first textbox is validated
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts