radtextbox returns value only on page load or textchange

929 views Asked by At

I have created a radtextbox in my ascx page and have set autopostback = "true".I have an insert button for submitting the usercontrol details. But the textbox returns the text value onnly on the first page load or if change my textbox text. If i give submit the button without changing the textbox value, textbox.text returns null even though it has text. The textbox does not return the existing value unless we do some events on rad textbox

All the controls are inside a place holder in .aspx :

<telerik:RadAjaxPanel ID="RadAjaxPanel2" runat="server">
<asp:Placeholder runat="server" ID="IELTSPanel">
<tr>
<th>IELTS Overall</th>
<th>Listening</th>
<th>Reading</th>
<th>Writing</th>
</tr>
<tr>
<td> 

sga:SgRadTextBox runat="server" ID="IELTSOverallTextBox" AutoPostBack="true" >--> not working
</sga:SgRadTextBox>

</td>
//other codes

<td>--. this is working correctly
<sga:SgRadTextBox runat="server" ID="IELTSNumberTextBox" AutoPostBack="true" Text='<%# LanguageProficiencyItem(IELTSProficiencyEnum.IELTSNumber.ToString())!=null? LanguageProficiencyItem(IELTSProficiencyEnum.IELTSNumber.ToString()).Value.Value:string.Empty%'></sga:SgRadTextBox>
</td>
</asp:Placeholder>
</telerik:RadAjaxPanel>
</table>

//binding the values in .cs to a string based on a combo selection

protected void SaveValues(int languageProficiencyId) { //this text box where the value is not rendering without any text box evetns

SaveLanguageProficiencyDetail(languageProficiencyId, IELTSProficiencyEnum.IELTSOverall.ToString(), IELTSOverallTextBox.Text);

// other codes working correctly

SaveLanguageProficiencyDetail(languageProficiencyId, IELTSProficiencyEnum.IELTSNumber.ToString(), IELTSNumberTextBox.Text);

}

//insert button

<div class="ButtonToolBar">
<sga:ActionLinkButton ID="btnUpdate" Type="Save" CommandArgument="LanguageSave"
Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' 
runat="server" 
CommandName='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'></sga:ActionLinkButton>&nbsp;
<sga:ActionLinkButton ID="btnCancel" Text="Cancel" runat="server" Type="Cancel"
CausesValidation="False" CommandName="Cancel"></sga:ActionLinkButton>
</div>
2

There are 2 answers

0
vimala On

Final solution to this problem was figured out..If this problem arises like this, please make sure the particular control loses it's focus on user control page or make the div id to get focus in .aspx page which contains the user controls.

Eg: // server end on page load: id.focus(); - solves the above issue.

1
FeliceM On

Difficult to say where the problem is without looking at the code. However, you may need to refresh the page to see the changes, try adding this in your submit button:

 Response.Redirect(Request.RawUrl);

it may do the trick.