How to get and edit textbox values in grid?

Posted by Kk86kiran under Interview Questions on 4/19/2012 | Points: 10 | Views : 3208 | Status : [Member] | Replies : 16
Hi, Yesterday i have attend for one interview in that he gave me one task i.e, 2 textboxes are available and save button. In update panel i have one grid control. Now my task is if you any values in text boxes those will be displayed in grid and edit option also will work for that but save button will be out side the update panel. I tried but i did not get that. So can one clear my doubt?

k.m.j.kiran


Responses

Posted by: GSM_GSV on: 4/19/2012 [Member] Starter | Points: 25

Up
0
Down
Do you want to display the contents of your textboxes in gridview upon clicking save button?

---------------------------------------
Live the life you've dreamed

Regards
MADHU

Kk86kiran, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dotnetrajanikanth on: 4/19/2012 [Member] Starter | Points: 25

Up
0
Down
I recommend you to please post the code that you have attempted.

____________
www.flickr.com/photos/psdesigner/

Kk86kiran, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sunny4989 on: 4/19/2012 [Member] Starter | Points: 25

Up
0
Down
Can u please extend your question details more clearly???

------------------------------------------------
Learn throughout life

Kk86kiran, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dotnetrajanikanth on: 4/20/2012 [Member] Starter | Points: 25

Up
0
Down
I have one solution.

Use an xml file. Editing an xml file will be easy affiar.
bind it to the grid view.


____________
www.flickr.com/photos/psdesigner/

Kk86kiran, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dotnetrajanikanth on: 4/20/2012 [Member] Starter | Points: 25

Up
0
Down
http://www.w3schools.com/xsl/xsl_editxml.asp

____________
www.flickr.com/photos/psdesigner/

Kk86kiran, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dotnetrajanikanth on: 4/20/2012 [Member] Starter | Points: 25

Up
0
Down
http://forums.asp.net/t/983488.aspx

This will help you in making the grid view editable

____________
www.flickr.com/photos/psdesigner/

Kk86kiran, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sunny4989 on: 4/20/2012 [Member] Starter | Points: 25

Up
0
Down
@ DotnetRajanikanth

XML file is no need

------------------------------------------------
Learn throughout life

Kk86kiran, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kk86kiran on: 4/20/2012 [Member] Starter | Points: 25

Up
0
Down
2 text boxes available and one save button. In Update Panel i have one gridview. If enter any values in those text boxes those values will be displayed in the grid after clicking save button. In this button and text boxes are placed out side the update panel. Only grid in update panel. Edit also work in grid ?



k.m.j.kiran

Kk86kiran, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dotnetrajanikanth on: 4/20/2012 [Member] Starter | Points: 25

Up
0
Down
@Sunny4989

I suggested it as an alternative of database

____________
www.flickr.com/photos/psdesigner/

Kk86kiran, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dotnetrajanikanth on: 4/20/2012 [Member] Starter | Points: 25

Up
0
Down
@Kk86kiran

Editing can be performed in grid view. I have posted a link for that above reffer it.

____________
www.flickr.com/photos/psdesigner/

Kk86kiran, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kk86kiran on: 4/20/2012 [Member] Starter | Points: 25

Up
0
Down
I know how to edit a grid but i want to invoke a trigger in button from out side of the update panel.

k.m.j.kiran

Kk86kiran, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dotnetrajanikanth on: 4/20/2012 [Member] Starter | Points: 25

Up
0
Down
Use AsyncPostBackTrigger inside the trigger in update panel.

<body>

<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<fieldset>
<legend>UpdatePanel</legend>
<asp:Label ID="Label1" runat="server" Text="Panel created."></asp:Label><br />
</fieldset>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" />
</Triggers>

</asp:UpdatePanel>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /></div>
</form>
</body>


Refer this link also...

http://msdn.microsoft.com/en-us/library/bb399001.aspx In this link read the section Refreshing an UpdatePanel Control with an External Button

Hope this will help you

____________
www.flickr.com/photos/psdesigner/

Kk86kiran, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sunny4989 on: 4/20/2012 [Member] Starter | Points: 25

Up
0
Down
Hi kiran

Edit also work in grid ? ]]


What does it mean

------------------------------------------------
Learn throughout life

Kk86kiran, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: dhirenkaunar-15094 on: 4/20/2012 [Member] Starter | Points: 25

Up
0
Down
Hi Kiran,

As I have understood : On click of button you want to display text boxes values in the the grid with edit option . But save button is out side the update panel.

If that is the problem . then we can call the trigger event of panel which has grid and we will update grid columns.

Otherwize Could you please elaborate your problem little more.

Thanks & Rgards,
Dhiren Kumar Kaunar

Kk86kiran, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ravianand on: 5/12/2012 [Member] Starter | Points: 25

Up
0
Down
Can u please extend your question details more clearly???

Regards,
Ravi

Kk86kiran, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Meet1424 on: 5/12/2012 [Member] Starter | Points: 25

Up
0
Down
Hi, try this on button click !
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("Value", typeof(string)));
DataRow dr = dt.NewRow();
dr["Value"] = txtData.Text;
dt.Rows.Add(dr);
gvData.DataSource = dt;
gvData.DataBind();

I took a gridview inside updatepanel and one textbox and a button outside the updatepanel, when i input anything in textbox and click the button it binds the same input to gridview. I did not add any trigger for update panel and its working

Kk86kiran, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response