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 soniPosted Dec 4, 2012, 7:31 AM
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 PisipatiPosted Dec 10, 2012, 7:08 AM
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
Santosh PisipatiPosted Dec 10, 2012, 6:58 AM
Also Dev are you familiiar with Telerik Radcontrols??
Santosh
dev soniPosted Dec 10, 2012, 6:57 AM
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 PisipatiPosted Dec 10, 2012, 6:51 AM
if i enter the Value as $1.11 it shows 111 in the Gridview i Have attached it in the Debugging Mode.
dev soniPosted Dec 10, 2012, 6:42 AM
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 PisipatiPosted Dec 10, 2012, 6:32 AM
Also I have attached the Screen shot
dev soniPosted Dec 10, 2012, 6:26 AM
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 PisipatiPosted Dec 10, 2012, 6:18 AM
Yes i have tried but isn't coming..
dev soniPosted Dec 10, 2012, 6:15 AM
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 PisipatiPosted Dec 10, 2012, 5:55 AM
dev soniPosted Dec 10, 2012, 5:52 AM
$0.00 to "$0.00" it will work for you
thanks
Dev
:)
Santosh PisipatiPosted Dec 10, 2012, 5:40 AM
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 soniPosted Dec 10, 2012, 5:28 AM
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 PisipatiPosted Dec 10, 2012, 5:13 AM
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 soniPosted Dec 10, 2012, 4:54 AM
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 PisipatiPosted Dec 10, 2012, 4:39 AM
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,